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.

Showing 1-2 of 2 results.

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

A182487 Nextprime(F(n)) - prevprime(F(n)), where F(n) is the n-th Fibonacci number.

Original entry on oeis.org

3, 4, 4, 6, 4, 6, 6, 14, 10, 10, 6, 6, 8, 18, 12, 24, 16, 10, 6, 12, 30, 12, 24, 42, 30, 24, 60, 24, 30, 34, 30, 36, 46, 12, 36, 18, 34, 24, 24, 30, 36, 52, 72, 16, 22, 48, 44, 50, 34, 20, 20, 28, 44, 50, 40, 92, 60, 86, 16, 52, 48, 66, 46, 168, 50, 174, 36
Offset: 4

Views

Author

Alex Ratushnyak, May 02 2012

Keywords

Comments

Smallest prime following Fibonacci(n) minus largest prime immediately preceding Fibonacci(n). Starting from Fibonacci(4), because for n<4 there is no prime preceding Fibonacci(n).

Examples

			a(0) = A014208(4) - A180422(0) = 5 - 2 = 3,
a(7) = A014208(11) - A180422(7) = 97-83 = 14.
		

Crossrefs

Cf. A079677 (distance from F(n) to the nearest prime).

Programs

  • Maple
    a:= n-> (f-> nextprime(f)-prevprime(f))(combinat[fibonacci](n)):
    seq(a(n), n=4..100);  # Alois P. Heinz, Jul 29 2015
  • Mathematica
    Table[f = Fibonacci[n]; NextPrime[f] - NextPrime[f, -1], {n, 4, 100}] (* T. D. Noe, May 02 2012 *)

Formula

a(n) = A014208(n+4) - A180422(n).
Showing 1-2 of 2 results.