Trying to contact Red Orca for permission to print an answer in a book [migrated]

I apologize in advance for breaking protocol. I’m just looking to get an official okay on rewriting and publishing Red Orca’s answer in this thread in an upcoming book about Magic Items. I looked for alternative ways to contact them but fell short. It’s an incredible answer and I’d love to make it more widely known to people out there looking to categorize their own items.

They can reach out over reddit to u/griff-mac or Discord to griffmac#9421, if that’s more appropriate. Thanks in advance, and again, I hope I’m not breaking rules too egregiously.


Anyone know the answer to the this problem? A substitution rule describes how to take a sequence of symbols and convert it into a different sequence of symbols. For example, ABA→BBB, is a substitution rule which means that ABA can be replaced with BBB. Using this rule, the sequence AABAA would be transformed into the sequence ABBBA (the substituted symbols are in bold).

In this task, you will be given three substitution rules, a starting sequence of symbols and a final sequence of symbols. You are to use the substitution rules to convert the starting sequence into the final sequence, using a specified number of substitutions.

For example, if the three substitution rules were:

AA→AB AB→BB B→AA we could convert the sequence AB into AAAB in 4 steps, by the following substitutions:


where the symbols to be replaced are shown in bold. More specifically, from the initial sequence AB, substitute rule 2 starting at position 1, to get the result BB. From BB, substitute rule 3, starting at position 1, to get the result AAB. From AAB, substitute rule 3, starting at position 3, to get the result AAAA. From AAAA, substitute rule 1, starting at position 3, to get the result AAAB, which is the final sequence.

Input Specification The first three lines will contain the substitution rules. Each substitution rule will be a sequence of A’s and B’s, followed by a space following by another sequence of A’s and B’s. Both sequences will have between one and five symbols.

The next line contains three space separated values, S, I and F. The value S(1≤S≤15) is an integer specifying the number of steps that must be used, and the values I (the initial sequence) and F (the final sequence) are sequences of A’s and B’s, where there are at least one and at most 5 symbols in I and at least one and at most 50 symbols in F.

For 7 of the 15 marks available, S≤6.

For an additional 7 of the 15 available marks, S≤12.

Output Specification The output will be S lines long and describes the substitutions in order.

Line i of the output will contain three space-separated values, Ri, Pi, and Wi:

Ri is the substitution rule number (either 1, 2 or 3) that will be used. Pi is the starting position index of where the substitution rule will be applied in the sequence. Notice that the string is 1-indexed (i.e., the first character of the string is at index 1). Wi is the sequence that results from this substitution. Specifically, Wi is the sequence of symbols that results by applying substitution rule Ri starting at position Pi from the previous sequence of symbols, Wi−1, where we define W0 to be the initial sequence I. Note that WS=F, the final sequence. There will always be at least one sequence of S substitutions that will convert I into F. If there is more than one possible sequence of substitutions, any valid sequence will be accepted.

I tried using recursion but the program isn’t fast enough. Can anyone help?

The replacement function is an integral and the double integral yields a different answer than the normal double integral

I am fairly new to Mathematica. I have a quick inquiry. The code is simple and just 3 lines. Trying to do a replacement rule as follows

ruletrr = intsl[exp_] :> Integrate[exp, {u, u, 1}] intsl[Integrate[a[u],{u,0,u}]]/.ruletrr 

So basically I want replace the expression inside the square brackets after ‘intsl’ with integrating the expression from u to 1. The expression inside the square bracket is in fact an integral as well. The integrand is a function of u. However, after the second line, the answer is as follows

(1 - u)*Integrate[a[u], {u, 0, u}] 

The answer means that Mathematica takes the expression inside the square bracker as a constant and not a function of u. Kindly copy the preceding line to see the integration symbol as I can’t do it here.

The problem is the first two line is equivalent to the following code line

Integrate[a[u], {u, u, 1}, {u, 0, u}] 

The answers are different. Can someone let me know where is the mistake here or why is the integral evaluated.

The entire code input is as follows as a summary

ruletrr = intsl[exp_] :> Integrate[exp,{u,u,1}] intsl[Integrate[a[u],{u,0,u}]]/.ruletrr Integrate[a[u], {u, u, 1}, {u, 0, u}] 

The first two lines are equivalent to the third line but the answers are different

Thanks in advance,

Ehab Emad

Is “represents” a symmetric relation in the provided answer to TAOCP exercise 1.1.9?

In exercise 1.1.9 of volume 1 of The Art of Computer Programming, the reader is asked to

formulate a set-theoretic definition for the concept “$ C_2$ is a representation of $ C_1$

where $ C_1$ and $ C_2$ are computational methods described in the previous few pages (reproduced here so the question can be answered without needing the book).

Let us formally define a computational method to be a quadruple $ (Q,I,\Omega,f)$ , in which $ Q$ is a set containing subsets $ I$ and $ Ω$ , and $ f$ is a function from $ Q$ into itself. […] The four quantities $ Q$ , $ I$ , $ \Omega$ , $ f$ are intended to represent repectively the state of the computation, the input, the output, and the computational rule.

When I looked at the answer in the back, this definition was proposed:

For example we can say $ C_2$ represents $ C_1$ if there is a function $ g$ from $ I_1$ into $ I_2$ , a function $ h$ from $ Q_2$ into $ Q_1$ , and a function $ j$ from $ Q_2$ into the positive integers, satisfying the following conditions:

  • a) If $ x$ is in $ I_1$ then $ h(g(x)) = x$
  • b) If $ q$ is in $ Q_2$ then $ f_1(h(q)) = h(f_2^{[j(q)]}(q))$ , where $ f_2^{[j(q)]}$ means that the function $ f_2$ is to be iterated $ j(q)$ times.
  • c) If $ q$ is in $ Q_2$ then $ h(q)$ is in $ \Omega_1$ if and only if $ q$ is in $ \Omega_2$

Later on, discussing this definition, Knuth writes (emphasis mine):

The relation “$ C_2$ represents $ C_1$ ” generates an equivalence relation in which two computational methods apparently are equivalent if and only if they compute isomorphic functions of their inputs …

To be an equivalence relation, a relation must be symmetric. That is, for a relation $ R$ , $ (a, b) \in R$ implies $ (b, a) \in R$ . I don’t believe this is true of the given definition.

Consider the computational methods $ C_1$ and $ C_2$ , where

\begin{align*} C_2 &= \{Q_2, I_2, \Omega_2, f_2\}\ C_1 &= \{Q_1, I_1, \Omega_1, f_1\}\\ I_2 &= \{a_1, a_2\}\ \Omega_2 &= \{b_1, b_2\}\ Q_2 &= I_2 \cup \Omega_2\ f_2 &= \{(a_1, b_1), (a_2, b_2), (b_1, b_1), (b_2, b_2)\}\\ I_1 &= \{c\}\ \Omega_1 &= \{d\}\ Q_1 &= I_1 \cup \Omega_1\ f_1 &= \{(c, d), (d, d)\} \end{align*}

It can be shown that $ C_2$ represents $ C_1$ by $ g(q) = a_1$ , $ h = \{(a_1, c), (a_2, c), (b_1, d), (b_2, d)\}$ , and $ j(q) = 1$ .

However, $ C_1$ cannot represent $ C_2$ , because for any proposed $ g: I_2 \rightarrow I_1$ it must be the case that $ g(a_1) = g(a_2) = c$ . But $ h(c)$ can only be either $ a_1$ or $ a_2$ . If $ h(c) = a_1$ , then $ h(g(a_2)) = a_1 \neq a_2$ , but if $ h(c) = a_2$ , then $ h(g(a_1)) = a_2 \neq a_1$ . So in either case, the first requirement cannot be satisfied.

Has this been discussed elsewhere? So far my online searches haven’t revealed any answers on the subject. To the best of my knowledge, this hasn’t been errata’d (checked here).

Am I understanding the definition properly?

I’m uncertain about my result because of the specific wording “from $ Q_2$ into $ Q_1$ “, which seems to have varying meanings depending on where you ask (if it means “injection”, it adds different inconsistencies). It also seems strange to me that this property would be overlooked, since Knuth also specifically mentions that “represents” is transitive, and a counterexample like this is quite easily constructed.

In summary: is it not symmetric? Has this been addressed somewhere? Am I owed 0x$ 1.00?

i will provide 20 quora answer with upvotes for $13

:Now Quora Answers is a great way to promote your business and get traffic to your website. As we all know that Quora is one of the most popular site that helps to increase traffic to ones website. It is also good for getting good rank for website. offering Quora answers service with your link in relevant section. It will give you a rank boost as quora pages are indexed quickly also you will get a permanent backlink from quora. Com, its a major push for ranking service: 1.niche realated quora traffic 2.all answer are posted manually 3.all answer done with your keyword ans url 4.100% Satisfaction Guaranteed 5.100% – Organic Traffic. 6.Get targeted traffic to your website 7.100%money back gurantee 8. all answer will be upvoted with this don’t waste your time for choosing me

by: rumana91
Created: —
Category: Question/Answer
Viewed: 156

How to answer multiple queries for a tree?

I encountered an interesting problem based on tree-data-structure.

We are given a tree which has N nodes, with 1≤N≤105.

Time starts from second 1 and it continues for q seconds.

At each second, the value of each internal node is transferred to all of its child nodes. This happens with all the nodes, except leaf nodes.

Sometimes, at a given time p (seconds), we are asked to return the current value of node x.

There is this O(logN) approach: just find the pth ancestor of the given node x, and output its value.

A harder version of the same problem

Sometimes, at a given time p (seconds), we are asked to return the current value of node x, or we are said to update the value of node x to y.

How to solve this problem for q queries (seconds) efficiently, where 1≤q≤105.



N=5, q=8

Edges of the tree:-

4 3 3 1 5 2 1 2 

Values of nodes 1 to 5:-

1 10 4 9 4 


  • 1st second:- Add(1,6). Add the value 6 to node 1.
  • 2nd second:- What is the current value of node 3? (?,3)
  • 3rd second:- Add(3,5)
  • 4th second:- (?,3)
  • 5th second:- Add(2,2)
  • 6th second:- Add(5,10)
  • 7th second:- (?,5)
  • 8th second:- (?,4)

Expected Output

  • 6
  • 0
  • 33
  • 25


  • 1st second: 6,1,1,13,14 (Values of all nodes)
  • 2nd second: 0,6,6,14,15
  • 3rd second: 0,0,5,20,21
  • 4th second: 0,0,0,25,21
  • 5th second: 0,2,0,25,21
  • 6th second: 0,0,0,25,33
  • 7th second: 0,0,0,25,33
  • 8th second: 0,0,0,25,33

Drive a targeted traffic with answer 6 backlinks Quora for $1

Dear respected Buyer, Q-uora is a very popular and active Q/A Network which can offer each centered traffic and Do-follow backlinks to your website. Gig Features: Will be 100% satisfied. Get permanent backlinks Get organic traffic for your Quorra website Get targeted traffic for your business, website. High-Quality answer Content 100% original and unique niche related answer content. Perfect grammar, spellings, and punctuation Free plagiarism report (available on request). Backlinks from: High Page Authority: 92 High Domain Authority: 90 HighTrust Flow: 41 High Citation Flow: 51 Why me? Because I am a most considered writer on Question and Answer contents Thanks a lot.

Created: —
Category: Question/Answer
Viewed: 153

Reach your target with 2 Quora Answer for $1

Hello Dear, Quora is one of the best and active questions answer flatfrom, that can give both traffic and astounding backlinks to your website. Quara answer’s give you high DA PA backlinks. At this time Quora Answers is an incredible approach to advance your business and Website. Also It is likewise useful for getting great rank for a site. Service Features: Get perpetual backlinksGet natural traffic from Quora siteGet focused on traffic for your business, site.High-Quality answer Content100% unique and particular specialty associated answer content.

Created: —
Category: Question/Answer
Viewed: 10

best 20 quora answer service for you for $10

best quora answering service for youare you looking at the quora answering service? If you looking for that then you are in the right place.I am providing you 100% valuable quora answering service. I am done many of this work and I am sure I will do your work as well. YOU will order me because 1 I am providing you the best quora service 2 quality is much better than others 3 I can do this job comfortably 4 I am level 2 seller in this marketplace at quick time 5 I can do the job according to you 6 I will help you make the better result you can get by ordering Best ever 20 perfect quora answers Why buy my Service?? : 1. My All answer is Very informative.*** 2.All Answer has done by without software.**** 3.Niche related country based traffic.*** 4. All ans has done with your keyword and URL.*** 5.White hat method.**** 6. Exactly anchor your keywords.*** 7.100% genuine activity.****** 8.hand made the process.**** If you know more my quora service Fell free to contact with me now! 7/24 Hours Customer support Chat Conversation End Type a message… It is about quality, not quantity My work is to do the work completely

by: fahimr
Created: —
Category: Question/Answer
Viewed: 407