login
A110898
a(n) = 1 + a(n - a(n-1)) (n - a(n-1)) mod 3 + (n - a(n-2)) mod 4, with a(0) = 0, a(1) = 1.
3
0, 1, 3, 3, 2, 6, 1, 3, 8, 3, 5, 2, 8, 8, 4, 4, 9, 8, 6, 11, 6, 7, 5, 7, 10, 7, 11, 9, 12, 7, 8, 6, 10, 9, 7, 14, 6, 9, 6, 12, 14, 11, 6, 9, 15, 9, 12, 15, 10, 15, 13, 5, 17, 7, 15, 14, 8, 18, 16, 10, 12, 18, 16, 15, 15, 14, 20, 15, 6, 18, 17, 17, 17, 7, 16, 9, 15, 15, 19, 13, 16, 13, 21, 17
OFFSET
0,3
LINKS
MATHEMATICA
a[n_]:= a[n]= If[n<2, n, 1 +a[n-a[n-1]] +Mod[n-a[n-1], 3] -Mod[n-a[n-2], 3]];
Table[a[n], {n, 0, 100}]
PROG
(Magma) [n le 2 select n-1 else 1 + Self(n-Self(n-1)) - ((n+2-Self(n-1)) mod 3) + ((n+3-Self(n-2)) mod 4) : n in [1..101]]; // G. C. Greubel, Mar 30 2024
(SageMath)
@CachedFunction
def a(n): # a = A110898
if n<2: return n
else: return 1 +a(n-a(n-1)) -(n-a(n-1))%3 +(n-a(n-2))%4
[a(n) for n in range(101)] # G. C. Greubel, Mar 30 2024
CROSSREFS
Cf. A110897.
Sequence in context: A329690 A293521 A285443 * A264756 A267942 A374481
KEYWORD
nonn,easy,less
AUTHOR
Roger L. Bagula, Sep 20 2005
EXTENSIONS
Edited by G. C. Greubel, Mar 30 2024
STATUS
approved