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-3 of 3 results.

A166594 Maximal prime gap q-p encountered from 0 to least prime > n.

Original entry on oeis.org

2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
Offset: 0

Views

Author

Daniel Forgues, Oct 17 2009

Keywords

Examples

			a(0) = 2 since the least prime greater than 0 is 2 (first occurrence of gap 2).
a(7) = 4 since the least prime greater than 7 is 11 (first occurrence of gap 4).
		

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, 1996, Section VII.22, p. 249.

Crossrefs

A166597 Let p = largest prime <= n, with p(0)=p(1)=0, and let q = smallest prime > n; then a(n) = q-p.

Original entry on oeis.org

2, 2, 1, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 4, 4, 4, 4, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 2, 2, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 2, 2, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2, 2, 4, 4
Offset: 0

Views

Author

Daniel Forgues, Oct 17 2009

Keywords

Comments

Note the large prime gap of 72 between 31397 and 31469. This is the prime gap with the largest merit (cf. A111870), 72/log(31397)=6.95352 for primes less than 100000. Also 72/(log(31397))^2=0.67154 (cf. conjectures of Cramer-Granville, Shanks and Wolf) is largest for primes less than 100000. - Daniel Forgues, Oct 23 2009

Examples

			a(0) = 2 since the least prime greater than 0 is 2 (gap of 2 from 0 to 2).
a(9) = 4 since the least prime greater than 9 is 11 (gap of 4 from 7 to 11).
a(11) = 2 since the least prime greater than 11 is 13 (gap of 2 from 11 to 13).
		

Crossrefs

Cf. A111870. - Daniel Forgues, Oct 23 2009
See A327441 for the classic G(n) version. - N. J. A. Sloane, Sep 11 2019

Programs

  • Maple
    2,2,seq(nextprime(n)-prevprime(n+1), n=2..100); # Ridouane Oudra, Dec 28 2024
  • Mathematica
    f[n_]:=Module[{a=If[PrimeQ[n],n,NextPrime[n,-1]]}, NextPrime[n]-a]; Join[{2,2},Array[f,120,2]] (* Harvey P. Dale, May 17 2011 *)
  • PARI
    a(n) = nextprime(n+1) - precprime(n); \\ Michel Marcus, Mar 02 2023

Formula

From Ridouane Oudra, Dec 28 2024: (Start)
a(n) = A001223(A000720(n)), for n>1.
a(n) = A151800(n) - A007917(n), for n>1.
a(n) = A007918(n+1) - A151799(n+1), for n>1. (End)

Extensions

Definition rephrased by N. J. A. Sloane, Oct 25 2009

A345161 If n = Product (p_j^k_j) then a(n) = max (nextprime(p_j) - p_j), where nextprime = A151800.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 4, 1, 2, 2, 2, 2, 4, 4, 2, 1, 2, 2, 4, 2, 4, 2, 6, 2, 2, 4, 2, 4, 2, 2, 6, 1, 2, 2, 4, 2, 4, 4, 4, 2, 2, 4, 4, 2, 2, 6, 6, 2, 4, 2, 2, 4, 6, 2, 2, 4, 4, 2, 2, 2, 6, 6, 4, 1, 4, 2, 4, 2, 6, 4, 2, 2, 6, 4, 2, 4, 4, 4, 4, 2, 2, 2, 6, 4, 2, 4, 2, 2, 8, 2
Offset: 1

Views

Author

Ilya Gutkovskiy, Aug 26 2021

Keywords

Examples

			a(39) = a(3 * 13) = a(prime(2) * prime(6)), prime(3) - prime(2) = 5 - 3 = 2, prime(7) - prime(6) = 17 - 13 = 4, so a(39) = max(2, 4) = 4.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Max @@ (NextPrime[#[[1]]] - #[[1]] & /@ FactorInteger[n]); Table[a[n], {n, 1, 90}]

Formula

If n = Product (p_j^k_j) then a(n) = max (prime(pi(p_j) + 1) - p_j), where pi = A000720.
a(2^j*n) = a(n).
a(n^j) = a(n), j > 0.
a(prime(n)^j) = A001223(n), j > 0.
a(n!) = A327441(n).
a(prime(n)#) = A063095(n).
2 + Sum_{k=1..n-1} a(prime(k)^j) = prime(n), j > 0.
Sum_{d|n} mu(n/d) * a(d) = 0 if n is an even number or an odd number divisible by a square > 1.
Showing 1-3 of 3 results.