OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..10000
MATHEMATICA
a[n_]:= a[n]= If[n<2, n, 1 +a[n-a[n-1]] +Mod[n-a[n-2], 3] -Mod[n-a[n-1], 2]];
Table[a[n], {n, 0, 100}]
PROG
(Magma) [n le 2 select n-1 else 1 + Self(n-Self(n-1)) - ((n+1-Self(n-1)) mod 2) + ((n+2-Self(n-2)) mod 3) : n in [1..101]]; // G. C. Greubel, Mar 30 2024
(SageMath)
@CachedFunction
def a(n): # a = A110897
if n<2: return n
else: return 1 +a(n-a(n-1)) -(n-a(n-1))%2 +(n-a(n-2))%3
[a(n) for n in range(101)] # G. C. Greubel, Mar 30 2024
CROSSREFS
KEYWORD
nonn,easy,less
AUTHOR
Roger L. Bagula, Sep 20 2005
EXTENSIONS
Edited by G. C. Greubel, Mar 30 2024
STATUS
approved