cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A322004 Index i of the smallest Fibonacci number > n such that Fib(i) - n is a prime, or 0 if no such index exists.

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