Skip to content

Latest commit

 

History

History

recamanSequence

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Recaman Sequence

7 kyu link to kata
my solution

Return the nth term of the Recamán's sequence.

a(0) = 0;
    a(n-1) - n, if this value is positive and not yet in the sequence
  /

a(n) <
a(n-1) + n, otherwise

input range: 0 – 30 000


Numberphile video about Recamán's sequence