OFFSET
0,1
COMMENTS
Motivated by a recent "conjecture" seen on internet, that any number > 1 is of the form prime(i) + Fib(j) + Fib(k). Actually the number of such representations increases that fast that this conjecture seems not interesting. The present sequence shows that any number is the difference of a Fibonacci number and a prime, or such that n + some prime = some Fibonacci number. (See A322005 for the corresponding prime.) Most of the terms correspond to the index of the smallest Fibonacci number > n or the subsequent one. Local maxima and/or a(n) > a(n+1) + 1 correspond to numbers for which one has to look further. a(25) = 102 is a noteworthy example.
LINKS
Robert Israel, Table of n, a(n) for n = 0..5000
EXAMPLE
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.
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 *)
PROG
(PARI) a(n)=for(i=1, oo, ispseudoprime(fibonacci(i)-n)&&return(i))
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Dec 12 2018
STATUS
approved