login
Fibonacci sequence (mod 3).
12

%I #36 Dec 14 2023 05:10:44

%S 0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,

%T 1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,

%U 0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1,0,1,1,2,0,2,2

%N Fibonacci sequence (mod 3).

%H Vincenzo Librandi, <a href="/A082115/b082115.txt">Table of n, a(n) for n = 0..1000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/FibonacciNumber.html">Fibonacci Number</a>

%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,1).

%F Sequence is periodic with Pisano period 8.

%F a(n) = 1-floor(n/8)+floor((n-1)/8)+floor((n-3)/8)-2*floor((n-4)/8) +2*floor((n-5)/8)-floor((n-7)/8). - _Hieronymus Fischer_, Jul 01 2007

%F a(n) = 1+((n mod 8)+((n+1)mod 8)-2*((n+3)mod 8)+2*((n+4)mod 8) -((n+5)mod 8) -((n+7)mod 8))/8. - _Hieronymus Fischer_, Jul 01 2007

%F G.f.: (x+x^2+2x^3+2x^5+2x^6+x^7)/(1-x^8). - _Hieronymus Fischer_, Jul 01 2007

%F a(n) = A131295(n) mod 3 (for n>0). - _Hieronymus Fischer_, Jul 01 2007

%t Table[Mod[Fibonacci[n], 3], {n, 0, 100}](* _Vincenzo Librandi_, Feb 04 2014 *)

%t LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 1},{0, 1, 1, 2, 0, 2, 2, 1},103] (* _Ray Chandler_, Aug 27 2015 *)

%o (Magma) [Fibonacci(n) mod 3: n in [0..100]]; // _Vincenzo Librandi_, Feb 04 2014

%o (PARI) a(n)=fibonacci(n%8)%3 \\ _Charles R Greathouse IV_, Sep 28 2015

%Y Cf. A011655, A079343, A082116, A082117, A105870, A079344.

%K nonn,easy

%O 0,4

%A _Eric W. Weisstein_, Apr 03 2003

%E Added a(0)=0. - _Jon Perry_, Sep 15 2013