Problem 54660. Generate the Figure-Figure sequence
After discussing Scott Kim’s FIGURE-FIGURE Figure (below) in Gödel, Escher, Bach, Douglas Hofstadter introduced an integer sequence a (say) generated by this rule: it starts with 1, and each later term equals the sum of the previous term in a and the latest term that is not already contained the sequence a.
For example, the second term in the sequence is 3 because the first number not in the sequence is 2, and 1+2 = 3. The third term is 7 because the next term not in a is 4 and 3+4 = 7.
Not only is the complement of the sequence a equal to the differences between the terms, but together the two sequences contain all positive integers.
Write a function that returns the nth term of the sequence.
Solution Stats
Problem Comments
-
1 Comment
GeeTwo
on 25 Apr 2024
The description indicates that this is just the series of odd integers, because 2 will never be in a. To achieve the next number being 7, you need to also establish list b, being the numbers added, and that the next a is the previous a plus the smallest natural number neither in a nor b.
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Set the array elements whose value is 13 to 0
1369 Solvers
-
Is this triangle right-angled?
5814 Solvers
-
Sum of odd numbers in a matrix
575 Solvers
-
366 Solvers
-
Create the following sequence : 0 1 1 4 9 25 64 169 ...
181 Solvers
More from this Author281
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!