a[0]:0; recaman:set(0); recaman_next(n):=block([x:a[n-1]-n], if (x > 0) and not elementp(x, recaman) then ( a[n]:x, recaman:adjoin(x, recaman)) else ( a[n]:a[n-1]+n, recaman:adjoin(a[n], recaman))); for i:1 thru 30 do (recaman_next(i), print(i,"=",a[i])); 1 = 1 2 = 3 3 = 6 4 = 2 5 = 7 6 = 13 7 = 20 8 […]