Recaman's sequence: Difference between revisions

Content added Content deleted
m (Updated description and link for Fōrmulæ solution)
(clarify)
Line 2: Line 2:
The '''[[wp:Recamán's sequence|Recamán's sequence]]''' generates Natural numbers.
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>
Starting from a(0)=0, the n'th term <code>a(n)</code>, where n>0, 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>.
If the conditions ''don't'' hold then <code>a(n) = a(n-1) + n</code>.