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-10 of 25 results. Next

A014085 Number of primes between n^2 and (n+1)^2.

Original entry on oeis.org

0, 2, 2, 2, 3, 2, 4, 3, 4, 3, 5, 4, 5, 5, 4, 6, 7, 5, 6, 6, 7, 7, 7, 6, 9, 8, 7, 8, 9, 8, 8, 10, 9, 10, 9, 10, 9, 9, 12, 11, 12, 11, 9, 12, 11, 13, 10, 13, 15, 10, 11, 15, 16, 12, 13, 11, 12, 17, 13, 16, 16, 13, 17, 15, 14, 16, 15, 15, 17, 13, 21, 15, 15, 17, 17, 18, 22, 14, 18, 23, 13
Offset: 0

Views

Author

Jon Wild, Jul 14 1997

Keywords

Comments

Suggested by Legendre's conjecture (still open) that for n > 0 there is always a prime between n^2 and (n+1)^2.
a(n) is the number of occurrences of n in A000006. - Philippe Deléham, Dec 17 2003
See the additional references and links mentioned in A143227. - Jonathan Sondow, Aug 03 2008
Legendre's conjecture may be written pi((n+1)^2) - pi(n^2) > 0 for all positive n, where pi(n) = A000720(n), [the prime counting function]. - Jonathan Vos Post, Jul 30 2008 [Comment corrected by Jonathan Sondow, Aug 15 2008]
Legendre's conjecture can be generalized as follows: for all integers n > 0 and all real numbers k > K, there is a prime in the range n^k to (n+1)^k. The constant K is conjectured to be log(127)/log(16). See A143935. - T. D. Noe, Sep 05 2008
For n > 0: number of occurrences of n^2 in A145445. - Reinhard Zumkeller, Jul 25 2014

Examples

			a(17) = 5 because between 17^2 and 18^2, i.e., 289 and 324, there are 5 primes (which are 293, 307, 311, 313, 317).
		

References

  • J. R. Goldman, The Queen of Mathematics, 1998, p. 82.

Crossrefs

First differences of A038107.
Counts of primes between consecutive higher powers: A060199, A061235, A062517.

Programs

  • Haskell
    a014085 n = sum $ map a010051 [n^2..(n+1)^2]
    -- Reinhard Zumkeller, Mar 18 2012
    
  • Mathematica
    Table[PrimePi[(n + 1)^2] - PrimePi[n^2], {n, 0, 80}] (* Lei Zhou, Dec 01 2005 *)
    Differences[PrimePi[Range[0,90]^2]] (* Harvey P. Dale, Nov 25 2015 *)
  • PARI
    a(n)=primepi((n+1)^2)-primepi(n^2) \\ Charles R Greathouse IV, Jun 15 2011
    
  • Python
    from sympy import primepi
    def a(n): return primepi((n+1)**2) - primepi(n**2)
    print([a(n) for n in range(81)]) # Michael S. Branicky, Jul 05 2021

Formula

a(n) = A000720((n+1)^2) - A000720(n^2). - Jonathan Vos Post, Jul 30 2008
a(n) = Sum_{k = n^2..(n+1)^2} A010051(k). - Reinhard Zumkeller, Mar 18 2012
Conjecture: for all n>1, abs(a(n)-(n/log(n))) < sqrt(n). - Alain Rocchelli, Sep 20 2023
Up to n=10^6 there are no counterexamples to this conjecture. - Hugo Pfoertner, Dec 16 2024
Sorenson & Webster show that a(n) > 0 for all 0 < n < 7.05 * 10^13. - Charles R Greathouse IV, Jan 31 2025

A007491 Smallest prime > n^2.

Original entry on oeis.org

2, 5, 11, 17, 29, 37, 53, 67, 83, 101, 127, 149, 173, 197, 227, 257, 293, 331, 367, 401, 443, 487, 541, 577, 631, 677, 733, 787, 853, 907, 967, 1031, 1091, 1163, 1229, 1297, 1373, 1447, 1523, 1601, 1693, 1777, 1861, 1949, 2027, 2129, 2213, 2309, 2411, 2503
Offset: 1

Views

Author

Keywords

Comments

Suggested by Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2.
Legendre's conjecture is equivalent to a(n) < (n+1)^2. - Jean-Christophe Hervé, Oct 26 2013
From Jaroslav Krizek, Apr 02 2016: (Start)
Conjectures:
1) There is always a prime p between n^2 and n^2+n (verified up to 13*10^6).
2) a(n) is the smallest prime p such that n^2 < p < n^2+n; a(n) < n^2+n.
3) For all numbers k >= 1 there is the smallest number m > 2*(k+1) such that for all numbers n >= m there is always a prime p between n^2 and n^2 + n - 2k. Sequence of numbers m for k >= 1: 6, 8, 12, 13, 14, 24, 24, 24, 30, 30, 30, 31, 33, 35, 43, ...; lim_{k->oo} m/2k = 1. Example: k=2; for all numbers n >= 8 there is always a prime p between n^2 and n^2 + n - 4. (End)

References

  • Archimedeans Problems Drive, Eureka, 24 (1961), 20.
  • J. R. Goldman, The Queen of Mathematics, 1998, p. 82.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 19.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007491 = a007918 . a000290  -- Reinhard Zumkeller, Jun 07 2015
    
  • Magma
    [NextPrime(n^2): n in [1..50]]; // Vincenzo Librandi, Apr 30 2015
    
  • Maple
    [seq(nextprime(i^2), i=1..100)];
  • Mathematica
    NextPrime[Range[60]^2]  (* Harvey P. Dale, Mar 24 2011 *)
  • PARI
    vector(100,i,nextprime(i^2))
    
  • Python
    from sympy import nextprime
    def a(n): return nextprime(n**2)
    print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Jan 13 2023

Formula

a(n) = A007918(A000290(n)). - Reinhard Zumkeller, Jun 07 2015

Extensions

More terms from Labos Elemer, Nov 17 2000
Definition modified by Jean-Christophe Hervé, Oct 26 2013

A053000 a(n) = (smallest prime > n^2) - n^2.

Original entry on oeis.org

2, 1, 1, 2, 1, 4, 1, 4, 3, 2, 1, 6, 5, 4, 1, 2, 1, 4, 7, 6, 1, 2, 3, 12, 1, 6, 1, 4, 3, 12, 7, 6, 7, 2, 7, 4, 1, 4, 3, 2, 1, 12, 13, 12, 13, 2, 13, 4, 5, 10, 3, 8, 3, 10, 1, 12, 1, 2, 7, 10, 7, 6, 3, 20, 3, 4, 1, 4, 13, 22, 3, 10, 5, 4, 1, 14, 3, 10, 5, 6, 21, 2, 9, 10, 1, 4, 15, 4, 9, 6, 1, 6, 3, 14
Offset: 0

Views

Author

N. J. A. Sloane, Feb 21 2000

Keywords

Comments

Suggested by Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2.
Record values are listed in A070317, their indices in A070316. - M. F. Hasler, Mar 23 2013
Conjecture: a(n) <= 1+phi(n) = 1+A000010(n), for n>0. This improves on Oppermann's conjecture, which says a(n) < n. - Jianglin Luo, Sep 22 2023

References

  • J. R. Goldman, The Queen of Mathematics, 1998, p. 82.
  • R. K. Guy, Unsolved Problems in Number Theory, Section A1.

Crossrefs

Programs

  • Magma
    [NextPrime(n^2) - n^2: n in [0..100]]; // Vincenzo Librandi, Jul 06 2015
    
  • Maple
    A053000 := n->nextprime(n^2)-n^2;
  • Mathematica
    nxt[n_]:=Module[{n2=n^2},NextPrime[n2]-n2]
    nxt/@Range[0,100]  (* Harvey P. Dale, Dec 20 2010 *)
  • PARI
    A053000(n)=nextprime(n^2)-n^2  \\ M. F. Hasler, Mar 23 2013
    
  • Python
    from sympy import nextprime
    def a(n): nn = n*n; return nextprime(nn) - nn
    print([a(n) for n in range(94)]) # Michael S. Branicky, Feb 17 2022

Formula

a(n) = A013632(n^2). - Robert Israel, Jul 06 2015

Extensions

More terms from James Sellers, Feb 22 2000

A056927 Difference between n^2 and largest prime less than n^2.

Original entry on oeis.org

1, 2, 3, 2, 5, 2, 3, 2, 3, 8, 5, 2, 3, 2, 5, 6, 7, 2, 3, 2, 5, 6, 5, 6, 3, 2, 11, 2, 13, 8, 3, 2, 3, 2, 5, 2, 5, 10, 3, 12, 5, 2, 3, 8, 3, 2, 7, 2, 23, 8, 5, 6, 7, 2, 15, 20, 3, 12, 7, 2, 11, 2, 3, 6, 7, 6, 3, 2, 11, 2, 5, 6, 5, 2, 27, 2, 5, 12, 3, 8, 5, 6, 13, 6, 3, 8, 3, 2, 7, 8, 3, 2, 5, 12, 7, 6, 3
Offset: 2

Views

Author

Henry Bottomley, Jul 12 2000

Keywords

Comments

Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2 is equivalent to the conjecture that a(n) < 2n-1 for all n>1.
Will the most common subsequence seen be (2,3,2)? - Bill McEachen, Jan 30 2011

Examples

			a(4)=3 because largest prime less than 4^2 is 13 and 16-13=3.
		

Crossrefs

Programs

  • Maple
    A056927 := n-> n^2-prevprime(n^2); seq(A056927(n), n=2..100);
  • Mathematica
    Table[n2=n^2;n2-NextPrime[n2,-1],{n,2,100}] (* Vladimir Joseph Stephan Orlovsky, Mar 09 2011 *)
  • PARI
    {my(maxx=10000);n=2;ptr=2;while(n<=maxx,q=n^2;pp=precprime(q); diff=q-pp;print(ptr,"  ",diff);n++;ptr++ );} \\ Bill McEachen, May 07 2014

Formula

a(n) = A000290(n)-A053001(n).

Extensions

More terms from James Sellers, Jul 13 2000

A061265 Number of squares between n-th prime and (n+1)st prime.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1
Offset: 1

Views

Author

Amarnath Murthy, Apr 24 2001

Keywords

Comments

If n-th prime is a member of A053001 then a(n) is at least 1. If not, then a(n) = 0.
Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2 is equivalent to conjecturing that a(n) <= 1 for all n. - Vladeta Jovovic, May 01 2003
a(A038107(n)) = 1 for n > 1; a(A221056(n)) = 0. - Reinhard Zumkeller, Apr 15 2013

Examples

			a(3) = 0 as there is no square between 5, the third prime and 7, the fourth prime. a(4) = 1, as there is a square (9) between the 4th prime 7 and the 5th prime 11.
		

Crossrefs

Cf. A053001.
Cf. A038107.
Cf. A014085.

Programs

Formula

a(n) = floor(sqrt(prime(n+1))) - floor(sqrt(prime(n))). - Vladeta Jovovic, May 01 2003

Extensions

Extended by Patrick De Geest, Jun 05 2001
Offset changed from 0 to 1 by Harry J. Smith, Jul 20 2009

A077037 Largest prime < n^3.

Original entry on oeis.org

7, 23, 61, 113, 211, 337, 509, 727, 997, 1327, 1723, 2179, 2741, 3373, 4093, 4909, 5827, 6857, 7993, 9257, 10639, 12163, 13807, 15619, 17573, 19681, 21943, 24379, 26993, 29789, 32749, 35933, 39301, 42863, 46649, 50651, 54869, 59281, 63997
Offset: 2

Views

Author

Reinhard Zumkeller, Oct 21 2002

Keywords

Crossrefs

Programs

  • Mathematica
    PrimePrev[n_]:=Module[{k},k=n-1;While[ !PrimeQ[k],k-- ];k];f[n_]:=n^3;lst={};Do[AppendTo[lst,PrimePrev[f[n]]],{n,5!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 25 2010 *)
    Table[NextPrime[n^3, -1], {n, 2, 40}] (* Robert G. Wilson v, Aug 17 2010 *)
  • PARI
    a(n) = precprime(n^3); \\ Michel Marcus, Jan 14 2023
  • Python
    from sympy import prevprime
    def a(n):  return prevprime(n**3)
    print([a(n) for n in range(2, 41)]) # Michael S. Branicky, Jul 23 2021
    

Formula

a(n) > (n-1)^3 for all large n, by Ingham's theorem (see A060199). - Jonathan Sondow, Mar 27 2014

A056929 Difference between n^2 and average of smallest prime greater than n^2 and largest prime less than n^2.

Original entry on oeis.org

0, 0, 1, -1, 2, -1, 0, 0, 1, 1, 0, -1, 1, 0, 2, 1, 0, -2, 1, 0, 1, -3, 2, 0, 1, -1, 4, -5, 3, 1, -2, 0, -2, -1, 2, -1, 1, 4, 1, 0, -4, -5, -5, 3, -5, -1, 1, -4, 10, 0, 1, -2, 3, -5, 7, 9, -2, 1, 0, -2, 4, -9, 0, 1, 3, 1, -5, -10, 4, -4, 0, 1, 2, -6, 12, -4, 0, 3, -9, 3, -2, -2, 6, 1, -6, 2, -3
Offset: 2

Views

Author

Henry Bottomley, Jul 12 2000

Keywords

Comments

Conjecture: the most frequent value will be 1 (including sequence variants with any even power n^2k). - Bill McEachen, Dec 12 2022

Examples

			a(4)=1 because smallest prime greater than 4^2 is 17, largest prime less than 4^2 is 13, average of 17 and 13 is 15 and 16-15=1.
		

Crossrefs

Programs

  • Maple
    with(numtheory): A056929 := n-> n^2-(prevprime(n^2)+nextprime(n^2))/2);
  • Mathematica
    Array[# - Mean@ {NextPrime[#], NextPrime[#, -1]} &[#^2] &, 87, 2] (* Michael De Vlieger, May 20 2018 *)
  • PARI
    a(n) = n^2 - (nextprime(n^2) + precprime(n^2))/2; \\ Michel Marcus, May 20 2018

Formula

a(n) = A000290(n) - A056928(n).
a(n) = (A056927(n) - A053000(n))/2.

Extensions

More terms from James Sellers, Jul 13 2000

A056931 Difference between n-th oblong (promic) number, n(n+1), and the average of the smallest prime greater than n^2 and the largest prime less than (n+1)^2.

Original entry on oeis.org

0, 0, 0, 0, 0, -1, -1, 0, 3, -1, -2, -1, 0, 1, 2, 1, -3, -2, 0, 1, 1, -4, 2, -2, 0, 3, -1, 0, 0, -2, -3, 0, -3, 0, 0, 0, 3, 0, 5, -4, -6, -5, -3, 0, -6, 1, -2, 6, 2, -2, 1, -2, 0, 1, 9, 0, 2, -2, -3, 2, -1, -9, 1, 1, 2, -1, -6, -6, -1, -3, 0, 0, 0, 6, -1, -3, 3, -2, -7, 1, -2, 1, 2, -1, -4
Offset: 2

Views

Author

Henry Bottomley, Jul 12 2000

Keywords

Comments

a(1)=-0.5 which is not an integer

Examples

			a(4)=0 because smallest prime greater than 4^2 is 17, largest prime less than 5^2 is 23, average of 17 and 23 is 20 and 4*5-20=0
		

Crossrefs

Programs

  • Maple
    with(numtheory): A056931 := n-> n*(n+1)-(prevprime((n+1)^2)+nextprime(n^2))/2);

Formula

a(n) =A002378(n)-(A007491(n)+A053001(n+1))/2 =A002378(n)-A056930(n).

Extensions

More terms from James Sellers, Jul 13 2000

A060272 Distance from n^2 to closest prime.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 3, 2, 1, 6, 5, 2, 1, 2, 1, 4, 7, 2, 1, 2, 3, 6, 1, 6, 1, 2, 3, 2, 7, 6, 3, 2, 3, 2, 1, 2, 3, 2, 1, 12, 5, 2, 3, 2, 3, 2, 5, 2, 3, 8, 3, 6, 1, 2, 1, 2, 3, 10, 7, 2, 3, 2, 3, 4, 1, 4, 3, 2, 3, 2, 5, 4, 1, 2, 3, 2, 5, 6, 3, 2, 5, 6, 1, 4, 3, 4, 3, 2, 1, 6, 3, 2, 1, 4, 5, 4, 3, 2, 7, 8, 5, 2
Offset: 1

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			n=1: n^2=1 has next prime 2, so a(1)=1;
n=11: n^2=121 is between primes {113,127} and closer to 127, thus a(11)=6.
		

Crossrefs

Programs

  • Maple
    seq((s-> min(nextprime(s)-s, `if`(s>2, s-prevprime(s), [][])))(n^2), n=1..256);  # edited by Alois P. Heinz, Jul 16 2017
  • Mathematica
    Table[Function[k, Min[k - #, NextPrime@ # - k] &@ If[n == 1, 0, Prime@ PrimePi@ k]][n^2], {n, 103}] (* Michael De Vlieger, Jul 15 2017 *)
    Min[#-NextPrime[#,-1],NextPrime[#]-#]&/@(Range[110]^2) (* Harvey P. Dale, Jun 26 2021 *)
  • PARI
    a(n) = if (n==1, nextprime(n^2) - n^2, min(n^2 - precprime(n^2), nextprime(n^2) - n^2)); \\ Michel Marcus, Jul 16 2017

Formula

a(n) = abs(A000290(n) - A113425(n)) = abs(A000290(n) - A113426(n)). - Reinhard Zumkeller, Oct 31 2005

A056928 Average of the smallest prime greater than n^2 and the largest prime less than n^2.

Original entry on oeis.org

4, 9, 15, 26, 34, 50, 64, 81, 99, 120, 144, 170, 195, 225, 254, 288, 324, 363, 399, 441, 483, 532, 574, 625, 675, 730, 780, 846, 897, 960, 1026, 1089, 1158, 1226, 1294, 1370, 1443, 1517, 1599, 1681, 1768, 1854, 1941, 2022, 2121, 2210, 2303, 2405, 2490
Offset: 2

Views

Author

Henry Bottomley, Jul 12 2000

Keywords

Examples

			a(4)=15 because the smallest prime greater than 4^2 is 17, the largest prime less than 4^2 is 13, and the average of 17 and 13 is 15.
		

Crossrefs

Programs

Formula

a(n) = (A007491(n) - A053001(n))/2.
a(n) = A000290(n) + (A053000(n) - A056927(n))/2.
a(n) = A000290(n) - A056929(n).
Showing 1-10 of 25 results. Next