A163768 Distance of Fibonacci(n) to the closest prime which is not Fibonacci(n) itself.
2, 1, 1, 1, 1, 2, 1, 2, 2, 3, 2, 6, 5, 4, 2, 3, 4, 4, 5, 4, 2, 3, 2, 4, 13, 4, 10, 11, 14, 10, 23, 4, 4, 9, 10, 14, 11, 6, 12, 3, 2, 6, 7, 12, 16, 9, 24, 6, 5, 20, 18, 23, 14, 6, 9, 12, 10, 21, 4, 30, 13, 38, 4, 7, 16, 12, 19, 36, 22, 31, 4, 32, 11, 12, 60, 7, 2, 6, 27, 12, 62, 25, 20, 6, 19, 78
Offset: 0
Examples
a(0) = 2 because 2 is the closest prime to F(0) = 0, and 2-0 = 2. a(1) = 1 because 2 is the closest prime to F(1) = 1, and 2-1 = 1. a(3) = 1 because 3 is the closest prime to F(3) = 2 other than the prime F(3) = 2 itself, and 3-2 = 1.
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
Programs
-
Maple
A051700 := proc(n) if n < 2 then 2-n; elif n = 2 then 1 ; else min( nextprime(n)-n, n-prevprime(n) ); fi; end: A000045 := proc(n) combinat[fibonacci](n) ; end: A163768 := proc(n) A051700(A000045(n)) ; end: seq(A163768(n), n=0..100) ; # R. J. Mathar, Aug 06 2009
-
Mathematica
g[n_]:=Module[{fn=Fibonacci[n],a,b},a=NextPrime[fn,-1];b=NextPrime[fn];Min[Abs[fn-a],Abs[b-fn]]]; Table[g[i],{i,0,100}] (* Harvey P. Dale, Jan 15 2011 *)
Formula
Extensions
More terms from R. J. Mathar, Aug 06 2009, reformatted Aug 29 2009
Comments