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.

A163768 Distance of Fibonacci(n) to the closest prime which is not Fibonacci(n) itself.

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Aug 04 2009

Keywords

Comments

The closest prime to F(n) -- next closest if F(n) itself is prime -- for n = 0, 1, 2, 3, 4, ...:
2, 2, 2, 3, 2, 3 or 7, 7, 11, 19 or 23, 31 or 37, 53, 83, 139 or 149, 229, 379, 607 or 613.

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.
		

Crossrefs

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

For n not in A001605: a(n) = MIN{|A000045(n) - A000040(i)} = A079677(n).
For n in A001605: a(n) = MIN{k such that k > 0 and |A000045(n) - A000040(i)| = k}.
a(n) = A051700(A000045(n)). - R. J. Mathar, Aug 06 2009

Extensions

More terms from R. J. Mathar, Aug 06 2009, reformatted Aug 29 2009