OFFSET
1,6
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = (smallest prime >= Fibonacci(n)) - Fibonacci(n).
a(n) = 0 <=> n in { A001605 }. - Alois P. Heinz, Feb 04 2018
EXAMPLE
a(1) = a(2) = 1 because Fibonacci(1) = Fibonacci(2) = 1, the smallest prime >= 1 is 2, and 2 - 1 = 1.
a(3) = a(4) = a(5) = 0 because Fibonacci(3)=2, Fibonacci(4)=3, and Fibonacci(5)=5 are all prime.
MAPLE
a:= n-> (f-> nextprime(f-1)-f)(combinat[fibonacci](n)):
seq(a(n), n=1..100); # Alois P. Heinz, Feb 04 2018
MATHEMATICA
Table[If[PrimeQ[n], 0, NextPrime[n]-n], {n, Fibonacci[Range[90]]}] (* Harvey P. Dale, Jul 22 2016 *)
PROG
(UBASIC) 10 'FiboA 20 A=1:print A; 30 B=1:print B; 40 C=A+B:print C; :T=T+1 41 if C<>prmdiv(C) then print "<"; nxtprm(C)-C; ">":else print "<"; 0; ">"; 50 D=B+C:print D; 51 if D<>prmdiv(D) then print "<"; nxtprm(D)-D; ">":else print "<"; 0; ">"; 60 A=C:B=D:if T>22 then stop:else 40
(PARI) F=1; G=0; for(i=1, 100, print1(nextprime(F)-F, ", "); T=F; F+=G; G=T) \\ Hagen von Eitzen, Jul 20 2009
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Enoch Haga, Apr 28 2009
EXTENSIONS
More terms (cf. b-file) from Hagen von Eitzen, Jul 20 2009
Edited by Jon E. Schoenfield, Feb 04 2018
STATUS
approved