A322004 Index i of the smallest Fibonacci number > n such that Fib(i) - n is a prime, or 0 if no such index exists.
3, 4, 5, 5, 8, 6, 6, 12, 7, 15, 7, 7, 10, 12, 8, 9, 8, 9, 8, 8, 16, 9, 11, 9, 10, 102, 10, 9, 11, 9, 11, 9, 9, 15, 13, 12, 10, 12, 10, 15, 13, 12, 10, 12, 10, 18, 11, 12, 10, 36, 10, 66, 10, 10, 13, 12, 20, 21, 11, 24, 11, 12, 20, 15, 14, 12, 11, 24, 16, 15, 11, 12, 11, 12, 17, 33, 11, 12, 11, 21, 16, 18, 11, 12, 11, 12, 11, 11, 19, 15, 19, 12, 20, 21, 13, 24
Offset: 0
Keywords
Examples
For n = 0, Fibonacci(3) = 2 is the smallest Fibonacci number F such that F - n is a prime, so a(0) = 3. For n = 1, Fibonacci(4) = 3 is the smallest Fibonacci number F such that F - n = 3 - 1 = 2 is a prime, so a(1) = 4. For n = 2, Fibonacci(5) = 5 is the smallest Fibonacci number F such that F - n = 5 - 2 = 3 is a prime, so a(2) = 5.
Links
- Robert Israel, Table of n, a(n) for n = 0..5000
Programs
-
Maple
f:= proc(n) local p,k,a,b,c; a:= -n:b:= 1-n: for k from 2 do c:= b; b:= a+b+n; a:= c; if isprime(b) then return k fi od end proc: map(f, [$0..100]); # Robert Israel, Dec 14 2018
-
Mathematica
primeQ[n_] := n>0 && PrimeQ[n]; a[n_] := Module[{i=2}, While[!primeQ[Fibonacci[i]-n], i++]; i]; Array[a,100,0] (* Amiram Eldar, Dec 12 2018 *)
-
PARI
a(n)=for(i=1,oo,ispseudoprime(fibonacci(i)-n)&&return(i))
Comments