How can I generate the nth number in the Godel, Escher, Bach number sequence?

  • Thread starter recon
  • Start date
  • Tags
    Sequence
In summary, the conversation discusses the number sequence in Chapter III of Godel, Escher and Bach and how to generate the nth number in the sequence. The algorithm involves looking at different "levels" of the sequence and finding patterns in the differences between numbers. This can be broken down into functions for each level and can be applied recursively.
  • #1
recon
401
1
I've been reading Godel, Escher and Bach. In Chapter III - Figure and Ground, there is this number sequence:

1 3 7 12 18 26 35 45 56 69 ...

I understand that every number is expressed once, covert or overt, in the sequence above.

For example you can 'find' 2 in the gap between 1 and 3. You can 'find' 4 in the gap between 3 and 7, 5 in the gap between 7 and 12, etc.

Can someone please show me an algorithm that I can use for generating the nth number in this sequence?
 
Mathematics news on Phys.org
  • #2
Hey, I read that book too. Awesome stuff. I think what Hofstadter was trying to explain there was the different "levels" of sequences--am I correct?

If so, I think you have to take it another level. For example, the "first-level" differences between the numbers are 2, 4, 5, 6, 8, 9, 10, 11, 13,...

But this really doesn't tell you much. But the "second level" differences are 2, 1, 1, 2, 1, 1, 1, 2, ...

Hm. Seems like we may have a pattern. The "second level" differences have a 2, then two 1's, then a 2, then three 1's, then a 2...

I think from this you can set up the pattern. Let me know what you get.
 
  • #3
I get it now. Thanks philosophking. The problem wasn't primarily about looking at different "levels". It was about looking at the "Figure" and "Ground", i.e. the numbers themselves and the gaps between them on the "first level".
 
  • #4
philosophking said:
If so, I think you have to take it another level. For example, the "first-level" differences between the numbers are 2, 4, 5, 6, 8, 9, 10, 11, 13,...

But this really doesn't tell you much. But the "second level" differences are 2, 1, 1, 2, 1, 1, 1, 2, ...

Hm. Seems like we may have a pattern. The "second level" differences have a 2, then two 1's, then a 2, then three 1's, then a 2...

I think from this you can set up the pattern. Let me know what you get.
2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2,
ok so far
1, 1, 1, 1, 1, 1, 2
hmm...
 
  • #5
Grapes, are you trying to disprove me or confirm my results? I'm confused :P
 
  • #6
Your results (2, 1, 1, 2, 1, 1, 1, 2, ) are OK, I just extended them. The first level differences are just the numbers that were "left out" of the first sequence, the second level differences have a 2 whenever the first level differences skips over a element of the original sequence.
 
  • #7
The algorithm

I think I made the algorithm:

function GEB(){
i := 1;
p := 0;
L.[p] := 1;
while(true){
temp = true;
while(temp) {
if (temp = search(i,L))
i++;
}
L[p+1] := L[p] + i;
p++;
i++;
}
}



function search(x,L){

for (i=1, i<=n, i++){ // n is the number of elements of array L
if (L == x){
return true;
}
}
return false;
}


Is it correct?
 
  • #8
Take it up another level:

Code:
A = 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2

B = 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1

C = 1 2 3 ...

Now that's even easier, Its just like Pulse Width Modulation, the period of the off pulse increases with n.

Now define a function for each level, and plug each function into the other.

So operating on the integers A (1,2,3..) a function mapping to B and then likewise for A, its easier to program the algo if you break it down like that i think.

The first function would not be recursive like the rest though. i.e. F(n) : C -> B and G(b) : B -> A and G(a) : A -> X

G(x) can be applied recursivley as G(G(G(G(...))) etc...i think.
 
Last edited:

FAQ: How can I generate the nth number in the Godel, Escher, Bach number sequence?

What is the significance of the "Number Sequence" from GEB?

The "Number Sequence" from GEB, also known as the Hofstadter Sequence, is a mathematical sequence that follows a recursive pattern. It was first described by mathematician and cognitive scientist Douglas Hofstadter in his book "Gödel, Escher, Bach: An Eternal Golden Braid". The sequence has no practical application, but it serves as an example of self-referential systems and the concept of recursion.

How is the "Number Sequence" generated?

The "Number Sequence" is generated by starting with the numbers 0 and 1, and then building subsequent numbers by adding the previous two numbers together. For example, the third number in the sequence would be 0+1=1, the fourth number would be 1+1=2, and so on. The sequence can also be represented as a recursive formula: f(n) = f(n-1) + f(n-2).

Does the "Number Sequence" have a pattern or structure?

Yes, the "Number Sequence" has a recursive pattern that repeats itself. It follows the Fibonacci sequence, where each number is the sum of the two previous numbers. However, unlike the Fibonacci sequence, the "Number Sequence" has a more complex recursive structure that involves self-reference and repetition.

How is the "Number Sequence" related to other mathematical concepts?

The "Number Sequence" is related to several other mathematical concepts, including recursion, self-reference, and complexity. It also has connections to other areas of mathematics, such as number theory and algebra. Additionally, the sequence has been studied in relation to artificial intelligence and cognitive science, as it provides insight into the concept of self-awareness in machines.

Can the "Number Sequence" be extended or modified?

Yes, the "Number Sequence" can be extended or modified in various ways. For example, the sequence can be reversed, starting with the largest number and working backwards. It can also be modified by changing the initial numbers or the recursive formula. Additionally, the sequence can be combined with other sequences or mathematical concepts to create new variations.

Similar threads

Back
Top