9 lines
399 B
Text
9 lines
399 B
Text
print("First 15 members of Recaman's sequence: ");
|
|
recamanW().walk(15).apply("get",1).println();
|
|
|
|
n,a := recamanW().filter1("get",2); // ie filter(a[n].dup)
|
|
println("First duplicate number in series is: a(%d) = %d".fmt(n,a));
|
|
|
|
rw,ns,n,a,dup := recamanW(),1000,0,0,0;
|
|
do{ n,a,dup=rw.next(); if(not dup and a<1000) ns-=1; }while(ns);
|
|
println("Range 0..1000 is covered by terms up to a(%,d)".fmt(n));
|