Anonymous user
Recaman's sequence: Difference between revisions
m
added whitespace.
Not a robot (talk | contribs) (Add COBOL) |
m (added whitespace.) |
||
Line 1:
{{task}}
The '''[[wp:Recamán's sequence|Recamán's sequence]]''' generates Natural numbers.
Starting from zero, the n'th term <code>a(n)</code> is the previous term minus <code>n</code> i.e <code>a(n) = a(n-1) - n</code> but only if this is '''both''' positive ''and'' has not been previousely generated.<br>
If the conditions ''don't'' hold then <code>a(n) = a(n-1) + n</code>.
;Task:
|