login
A264105
a(n) = smallest k such that n divides Sum_{i=1..k} Fibonacci(i).
1
1, 2, 5, 3, 6, 5, 4, 9, 8, 6, 7, 5, 10, 15, 37, 21, 14, 8, 15, 6, 13, 9, 20, 21, 46, 27, 8, 15, 11, 39, 27, 45, 7, 14, 20, 21, 34, 15, 53, 57, 16, 15, 40, 9, 40, 20, 12, 21, 52, 99, 69, 27, 50, 8, 17, 36, 15, 11, 55, 39, 26, 27, 16, 93, 66, 29, 64, 33, 45, 20
OFFSET
1,2
COMMENTS
Or smallest k such that n | A000071(k+2),
or smallest k such that n | A000045(k+2)-1,
where Fibonacci(n) = A000045(n) and A000071(n) = A000045(n)-1.
Remark: a(n) always exists for all n because the Fibonacci sequence is periodic mod n.
For all integers n, there exists an integer m such that a(m) = n. For instance if m = Fibonacci(n+2)-1, then a(m) = n.
LINKS
EXAMPLE
a(13) = 10 because Sum_{i=1..10} Fibonacci(i) = 1+1+2+3+5+8+13+21+34+55 = 143 = 11*13 is divisible by 13. Or 13 | A000071(12) => 13|143.
MAPLE
fib:= gfun:-rectoproc({f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2)}, f(n), remember):
a:= proc(n) local k; for k from 1 do if fib(k+2)-1 mod n = 0 then return k fi od end proc:
seq(a(i), i=1..1000); # Robert Israel, Nov 03 2015
MATHEMATICA
Table[s=0; k=0; While[k++; s=Mod[s+Fibonacci[k], n]; s>0]; k, {n, 100}]
Module[{nn=100, sk}, sk=Thread[{Accumulate[Fibonacci[Range[2nn]]], Range[ 2nn]}]; Table[SelectFirst[sk, Divisible[#[[1]], n]&], {n, nn}]][[All, 2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 10 2020 *)
PROG
(PARI) a(n) = {k=1; while(k, if( (fibonacci(k+2)-1) % n == 0, return(k)); k++)} \\ Altug Alkan, Nov 05 2015
CROSSREFS
Sequence in context: A331212 A160516 A341492 * A024871 A222072 A246007
KEYWORD
nonn
AUTHOR
Michel Lagneau, Nov 03 2015
STATUS
approved