OFFSET
0,4
COMMENTS
Sequence has a period of 24.
LINKS
Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1).
FORMULA
F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1 and F(n) = F(n-1) + F(n-2) - 6 if F(n-1) + F(n-2) > 6.
G.f.: ( -x *(1 +x +2*x^2 +3*x^3 +5*x^4 +2*x^5 +x^6 +3*x^7 +4*x^8 +x^9 +5*x^10 +6*x^11 +5*x^12 +5*x^13 +4*x^14 +3*x^15 +x^16 +4*x^17 +5*x^18 +3*x^19 +2*x^20 +5*x^21 +x^22 +6*x^23) ) / ( (x-1) *(1+x+x^2) *(1+x) *(1-x+x^2) *(1+x^2) *(x^4-x^2+1) *(1+x^4) *(x^8-x^4+1) ). - R. J. Mathar, Apr 16 2016
EXAMPLE
For n = 6; F(5) + F(4) equals 8 then F(6) = 8 - 6 = 2.
MAPLE
A269701 := proc(n)
option remember;
if n <=5 then
combinat[fibonacci](n) ;
else
a := procname(n-1)+procname(n-2) ;
if a > 6 then
a-6;
else
a;
end if;
end if;
end proc: # R. J. Mathar, Apr 16 2016
MATHEMATICA
Table[Mod[Fibonacci[n], 6], {n, 100}] /. 0 -> 6 (* Alonso del Arte, Mar 28 2016 *)
PadRight[{0}, 120, {6, 1, 1, 2, 3, 5, 2, 1, 3, 4, 1, 5, 6, 5, 5, 4, 3, 1, 4, 5, 3, 2, 5, 1}] (* Harvey P. Dale, May 13 2019 *)
PROG
(Erlang)
fibocy(1) -> 1;
fibocy(2) -> 1;
fibocy(N) when N > 1 ->
Tmp = fibocy(N-1) + fibocy(N-2),
if Tmp > 6 -> Tmp - 6;
true -> Tmp
end.
CROSSREFS
KEYWORD
nonn,easy,less
AUTHOR
Gabriel Osorio, Mar 04 2016
STATUS
approved