login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
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,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
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
Cf. A000040 (primes), A000045 (Fibonacci numbers).
Sequence in context: A300778 A199084 A344371 * A240214 A181132 A278168
KEYWORD
nonn
AUTHOR
M. F. Hasler, Dec 12 2018
STATUS
approved