login
a(n) = Fibonacci(n) mod n.
20

%I #52 Oct 27 2023 19:25:09

%S 0,1,2,3,0,2,6,5,7,5,1,0,12,13,10,11,16,10,1,5,5,1,22,0,0,25,20,11,1,

%T 20,1,5,13,33,30,0,36,1,37,35,1,34,42,25,20,45,46,0,36,25,32,23,52,8,

%U 5,21,40,1,1,0,1,1,43,59,60,52,66,65,44,15,1,0,72,73,50,3,2,44,1,5,7,1,82,24

%N a(n) = Fibonacci(n) mod n.

%D S. Wolfram, A New Kind of Science, Wolfram Media, 2002, p. 891.

%H Alois P. Heinz, <a href="/A002708/b002708.txt">Table of n, a(n) for n = 1..10000</a> (first 5000 terms from T. D. Noe)

%H E. Lucas, <a href="/A000899/a000899.pdf">Théorie des nombres</a> (annotated scans of a few selected pages)

%p with(combinat): [ seq( fibonacci(n) mod n, n=1..80) ];

%p # second Maple program:

%p a:= proc(n) local r, M, p; r, M, p:=

%p <<1|0>, <0|1>>, <<0|1>, <1|1>>, n;

%p do if irem(p, 2, 'p')=1 then r:= r.M mod n fi;

%p if p=0 then break fi; M:= M.M mod n

%p od; r[1, 2]

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Nov 26 2016

%t Table[Mod[Fibonacci[n], n], {n, 1, 100}] (* _Stefan Steinerberger_, Apr 18 2006 *)

%o (Magma) [Fibonacci(n) mod n : n in [1..120]]; // _Vincenzo Librandi_, Nov 19 2015

%o (Python)

%o A002708_list, a, b, = [], 1, 1

%o for n in range(1,10**4+1):

%o A002708_list.append(a%n)

%o a, b = b, a+b # _Chai Wah Wu_, Nov 26 2015

%o (PARI) a(n) = fibonacci(n) % n; \\ _Michel Marcus_, May 11 2016

%Y Cf. A002726, A002752, A023172 (indices of 0's), A023173 (indices of 1's), A023174-A023182.

%Y Cf. A263101.

%Y Main diagonal of A161553.

%K nonn,easy,look

%O 1,3

%A John C. Hallyburton, Jr. (hallyb(AT)evms.ENET.dec.com)

%E More terms from _Stefan Steinerberger_, Apr 18 2006