How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the Quackery programming language
How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the Quackery programming language
Table of Contents
Problem Statement
The definition of the sequence is colloquially described as: Note that indexing for the description above starts from alternately the left and right ends of the list and starts from an index of one. A less wordy description of the sequence is: The sequence begins: Interesting features of the sequence are that:
The sequence is so named because John Conway offered a prize of $10,000 to the first person who could find the first position, p in the sequence where It was later found that Hofstadter had also done prior work on the sequence. The 'prize' was won quite quickly by Dr. Colin L. Mallows who proved the properties of the sequence and allowed him to find the value of n (which is much smaller than the 3,173,375,556 quoted in the NYT article).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the Quackery programming language
Source code in the quackery programming language
[ $ "bigrat.qky" loadfile ] now!
[ ' [ 1 1 ]
swap 2 - times
[ dup -1 peek 2dup 1 - peek
dip [ dip dup negate peek ]
+ join ] ] is hof-con ( n --> [ )
[ behead do rot
witheach
[ do 2over 2over v- v0<
if 2swap
2drop ] ] is maximum ( [ --> n n )
20 dup bit 1 - hof-con
[] swap witheach
[ i^ 1+ join nested join ]
swap 1 - bit times
[ i^ 1+ dup 2dup
say "Maximum in range " echo
say " to " 1 << 1 - echo
step split swap maximum
say " at n = "
dup echo
say " is " 10 point$ echo$ cr ]
drop
You may also check:How to resolve the algorithm Doubly-linked list/Element insertion step by step in the Visual Basic .NET programming language
You may also check:How to resolve the algorithm Test a function step by step in the Euphoria programming language
You may also check:How to resolve the algorithm Primality by Wilson's theorem step by step in the PROMAL programming language
You may also check:How to resolve the algorithm Literals/Floating point step by step in the Eiffel programming language
You may also check:How to resolve the algorithm Best shuffle step by step in the FreeBASIC programming language