login
A110897
a(n) = 1 + a(n - a(n-1)) (n - a(n-1)) mod 2 + (n - a(n-2)) mod 3, with a(0) = 0, a(1) = 1.
3
0, 1, 3, 3, 2, 5, 2, 7, 1, 4, 3, 3, 4, 5, 5, 5, 5, 5, 6, 7, 7, 8, 6, 5, 7, 9, 6, 8, 9, 8, 7, 10, 8, 11, 7, 10, 9, 10, 12, 10, 9, 10, 9, 8, 12, 12, 9, 15, 11, 14, 10, 11, 10, 8, 12, 10, 12, 14, 14, 12, 13, 13, 15, 14, 12, 8, 15, 13, 12, 16, 14, 15, 15, 16, 17, 17, 14, 14, 14, 10, 15, 18, 14, 18
OFFSET
0,3
LINKS
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
Sequence in context: A151848 A238238 A117937 * A116644 A166462 A328177
KEYWORD
nonn,easy,less
AUTHOR
Roger L. Bagula, Sep 20 2005
EXTENSIONS
Edited by G. C. Greubel, Mar 30 2024
STATUS
approved