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”).
%I #14 Dec 16 2018 06:18:55
%S 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,
%T 9,11,9,9,15,13,12,10,12,10,15,13,12,10,12,10,18,11,12,10,36,10,66,10,
%U 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
%N Index i of the smallest Fibonacci number > n such that Fib(i) - n is a prime, or 0 if no such index exists.
%C 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.
%H Robert Israel, <a href="/A322004/b322004.txt">Table of n, a(n) for n = 0..5000</a>
%e For n = 0, Fibonacci(3) = 2 is the smallest Fibonacci number F such that F - n is a prime, so a(0) = 3.
%e 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.
%e 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.
%p f:= proc(n) local p,k,a,b,c;
%p a:= -n:b:= 1-n:
%p for k from 2 do
%p c:= b;
%p b:= a+b+n;
%p a:= c;
%p if isprime(b) then return k fi
%p od
%p end proc:
%p map(f, [$0..100]); # _Robert Israel_, Dec 14 2018
%t 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 *)
%o (PARI) a(n)=for(i=1,oo,ispseudoprime(fibonacci(i)-n)&&return(i))
%Y Cf. A000040 (primes), A000045 (Fibonacci numbers).
%K nonn
%O 0,1
%A _M. F. Hasler_, Dec 12 2018