OFFSET
0,7
COMMENTS
Lim_{n -> infinity} <a(n+1)/a(n)> = 1.324717957244746, where <> is the expectation value.
REFERENCES
.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..500
MATHEMATICA
a[n_]:= a[n]= If[n==0, 0, If[n<4, 1, If[Mod[n, 3]==0, a[n-2] + a[n-3], If[Mod[n, 4] ==0, a[n-1] + a[n-4], a[n-1] ]]]];
Table[a[n], {n, 0, 65}] (* modified by G. C. Greubel, Mar 29 2021 *)
PROG
(Magma)
function a(n)
if n eq 0 then return 0;
elif n lt 4 then return 1;
elif (n mod 3) eq 0 then return a(n-2) + a(n-3);
elif (n mod 4) eq 0 then return a(n-1) + a(n-4);
else return a(n-1);
end if; return a;
end function;
[a(n): n in [0..65]]; // G. C. Greubel, Mar 29 2021
(Sage)
@CachedFunction
def a(n):
if (n==0): return 0
elif (n<4): return 1
elif (n%3==0): return a(n-2) + a(n-3)
elif (n%4==0): return a(n-1) + a(n-4)
else: return a(n-1)
[a(n) for n in (0..65)] # G. C. Greubel, Mar 29 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Aug 11 2008
EXTENSIONS
Edited by G. C. Greubel, Mar 29 2021
STATUS
approved