Anonymous user
Hofstadter Figure-Figure sequences: Difference between revisions
Hofstadter Figure-Figure sequences (view source)
Revision as of 00:24, 20 November 2012
, 11 years agoffr and ffs defined
m (→{{header|REXX}}: added a comment in the section header. -- ~~~~) |
(ffr and ffs defined) |
||
Line 924:
R(10) = 69
1000 integer check ok.</pre>
=={{header|Mathematica}} ==
1. Create two functions named ffr and ffs that when given n return R(n) or S(n) respectively.
2. No maximum value for n should be assumed.
<lang Mathematica>
ffr[j_] := Module[{R = {1}, S = 2, k = 1},
Do[While[Position[R, S] != {}, S++]; k = k + S; S++;
R = Append[R, k], {n, 1, j - 1}]; R]
ffs[j_] := Differences[ffr[j + 1]]
</lang>
=={{header|MATLAB}} / {{header|Octave}}==
|