Hofstadter Figure-Figure sequences: Difference between revisions

A
m (RPL: add section)
(A)
Line 2,395:
True
</pre>
 
=={{header|Quackery}}==
 
As with the Phix solution, initialising to the first few elements simplified things significantly.
 
<syntaxhighlight lang="Quackery">
[ ' [ 1 3 7 ]
' [ 2 4 5 6 ] ] is initialise ( --> r s )
 
[ over size 1 -
over swap peek
dip [ over -1 peek ]
+ swap dip join
over -2 split nip do
temp put
1 + from
[ temp share
index = iff
end done
index join ]
temp release ] is extend ( r s n --> r s )
 
[ temp put
[ over size
temp share < while
extend again ]
over
temp take 1 - peek ] is ffr ( r s n --> r s n )
 
[ temp put
[ dup size
temp share < while
extend again ]
dup
temp take 1 - peek ] is ffs ( r s n --> r s n )
 
initialise
say "R(1)..R(10): "
10 times
[ i^ 1+ ffr echo sp ]
cr cr
960 ffs drop
960 split drop
dip [ 40 split drop ]
join sort
[] 1000 times
[ i^ 1+ join ]
!=
say "All integers from 1 to 1000"
if say " not"
say " found once and only once."</syntaxhighlight>
 
{{out}}
 
<pre>R(1)..R(10): 1 3 7 12 18 26 35 45 56 69
 
All integers from 1 to 1000 found once and only once.</pre>
 
=={{header|R}}==
1,462

edits