Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 May 13 2019 13:14:59
%S 0,1,1,2,3,5,2,1,3,4,1,5,6,5,5,4,3,1,4,5,3,2,5,1,6,1,1,2,3,5,2,1,3,4,
%T 1,5,6,5,5,4,3,1,4,5,3,2,5,1,6,1,1,2,3,5,2,1,3,4,1,5,6,5,5,4,3,1,4,5,
%U 3,2,5,1,6,1,1,2,3,5,2,1,3,4,1,5,6,5,5,4,3,1,4,5,3,2,5,1,6,1
%N Cyclic Fibonacci sequence, restricted to maximum=6
%C Sequence has a period of 24.
%H <a href="/index/Rec#order_24">Index entries for linear recurrences with constant coefficients</a>, 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).
%F 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.
%F 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
%e For n = 6; F(5) + F(4) equals 8 then F(6) = 8 - 6 = 2.
%p A269701 := proc(n)
%p option remember;
%p if n <=5 then
%p combinat[fibonacci](n) ;
%p else
%p a := procname(n-1)+procname(n-2) ;
%p if a > 6 then
%p a-6;
%p else
%p a;
%p end if;
%p end if;
%p end proc: # _R. J. Mathar_, Apr 16 2016
%t Table[Mod[Fibonacci[n], 6], {n, 100}] /. 0 -> 6 (* _Alonso del Arte_, Mar 28 2016 *)
%t 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 *)
%o (Erlang)
%o fibocy(1) -> 1;
%o fibocy(2) -> 1;
%o fibocy(N) when N > 1 ->
%o Tmp = fibocy(N-1) + fibocy(N-2),
%o if Tmp > 6 -> Tmp - 6;
%o true -> Tmp
%o end.
%Y Cf. A000045 (Fibonacci numbers), A082117.
%K nonn,easy,less
%O 0,4
%A _Gabriel Osorio_, Mar 04 2016