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

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

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 2, 2, 4, 2, 2, 3, 2, 4, 4, 1, 2, 3, 3, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 4, 5, 7, 3, 6, 6, 8, 5, 5, 7, 4, 6, 7, 6, 7, 6, 6, 5, 9, 7, 7, 6, 7, 7, 6, 8, 8, 7, 7, 8, 9, 11, 7, 8, 10, 8, 11, 8, 7, 7, 10, 11, 12, 4, 9, 11, 6, 9, 9, 10, 8, 9, 8, 11, 8, 8, 9, 10, 8, 13, 10, 9, 10, 14, 12
Offset: 1

Views

Author

Cino Hilliard, Dec 30 2003

Keywords

Comments

For small values of n, these numbers exhibit higher and lower values as n increases. Conjectures: After n=17 a(n) > 1. There exists an n_1 such that a(n) is < a(n+1) for all n >= n_1.
Same as the number of primes between n^2 and n^2+n. Oppermann conjectured in 1882 that a(n)>0. - T. D. Noe, Sep 16 2008

References

  • Paulo Ribenboim, The New Book of Prime Number Records, 3rd ed., 1995, Springer, p. 248.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 183.

Crossrefs

Programs

  • Haskell
    a089610 n = sum $ map a010051' [n^2 .. n*(n+1)]
    -- Reinhard Zumkeller, Jun 07 2015
  • Mathematica
    a[n_] := PrimePi[(n + 1/2)^2] - PrimePi[n^2]; Table[ a@n, {n, 100}] (* Robert G. Wilson v, May 04 2009 *)
  • PARI
    a(n) = primepi(n^2+n) - primepi(n^2); \\ Michel Marcus, May 18 2020
    

A108309 Consider the triangle of odd numbers where the n-th row has the next n odd numbers. The sequence is the number of primes in the n-th row.

Original entry on oeis.org

0, 2, 2, 3, 2, 3, 3, 4, 4, 5, 3, 4, 6, 4, 6, 6, 4, 6, 7, 6, 8, 7, 5, 8, 9, 8, 7, 8, 9, 8, 9, 10, 10, 8, 10, 12, 5, 12, 12, 13, 9, 11, 11, 9, 13, 14, 9, 14, 14, 10, 10, 19, 14, 12, 12, 12, 12, 16, 15, 16, 15, 13, 18, 16, 16, 12, 16, 17, 15, 16, 18, 14, 15, 20, 18, 19, 14, 19, 20, 18, 16
Offset: 1

Views

Author

Giovanni Teofilatto, Jul 25 2005

Keywords

Comments

Except for the initial term, a(n)>=2 because in the interval 2n-1 of odd numbers there are always at least two primes.
For n>2, this is the same as the number of primes between n^2-n and n^2+n, which is the sum of A089610 and A094189. - T. D. Noe, Sep 16 2008
a(n) = SUM(A010051(A176271(n,k)): 1<=k<=n). - Reinhard Zumkeller, Apr 13 2010
From Pierre CAMI, Sep 03 2014: (Start)
For n>1 a(n)~floor(1/2 + n/log(n)).
The number of primes < n^2 is ~ n^2/2/log(n) by the prime number theorem, as a(n) ~ floor(1/2 + n/log(n)) we have:
n^2/2/log(n) ~ 1 + floor(1/2 + 2/log(2)) + floor(1/2 + 3/log(3)) + floor(1/2 + 4/log(4)) + ... + floor(1/2 + (n-1)/log(n-1)) + floor(1/2 + n/log(n)).
For n=16000 the number of primes < n^2 is 13991985, the sum: 1 + floor(1/2 + 2/log(2)) + floor(1/2 + 3/log(3)) + floor(1/2 + 4/log(4))+ ... + floor(1/2 + (n-1)/log(n-1)) + floor(1/2 + n/log(n)) is 13991101 and (n^2)/(2*log(n)) is 13222671.
So between n^2+n and n^2+3*n there are n odd numbers and ~floor(1/2 + n/log(n)) prime numbers.
The twin primes are of the form T1=n^2+n-1 and T2=n^2+n+1, or n^2+n+T1 and n^2+n+T2 with T1<=2*n-1, or n^2+n+P and n^2+n+P(-2 or +2) with P prime <=2*n-1.
(End)

Examples

			Triangle begins:
1: 1 -> 0 primes,
2: 3,5 -> 2 primes,
3: 7,9,11 -> 2 primes,
4: 13,15,17,19 -> 3 primes.
		

Crossrefs

Programs

  • Haskell
    a108309 = sum . (map a010051) . a176271_row
    -- Reinhard Zumkeller, May 24 2012
  • Maple
    seq(numtheory:-pi(n^2+n-1)-numtheory:-pi(n^2-n),n=1..100); # Robert Israel, Sep 03 2014
  • Mathematica
    f[n_] := PrimePi[n^2 + n - 1] - PrimePi[n^2 - n]; Table[f[n], {n, 81}] (* Ray Chandler, Jul 26 2005 *)

Extensions

Edited and extended by Ray Chandler, Jul 26 2005

A216265 Number of primes between n^3 - n and n^3.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Mar 15 2013

Keywords

Comments

Conjecture: a(n) > 0 for n > 13.

Examples

			a(9) = 1 because between 9^3 - 9 and 9^3 there is just one prime (727).
a(10) = 2 because between 10^3 - 10 and 10^3 there are two primes (991 and 997).
a(11) = 2 because between 11^3 - 11 and 11^3 there are two primes (1321 and 1327).
		

Crossrefs

Programs

  • Java
    import java.math.BigInteger;
    public class A216265 {
        public static void main (String[] args) {
          for (long n = 1; n < (1 << 21); n++) {
            long cube = n*n*n, c = 0;
            for (long k = cube - n; k < cube; ++k) {
              BigInteger b1 = BigInteger.valueOf(k);
              if (b1.isProbablePrime(2)) {
                if (b1.isProbablePrime(80))
                  ++c;
              }
            }
            System.out.printf("%d, ", c);
          }
        }
    } // Ratushnyak
    
  • Maple
    a:= n-> add(`if`(isprime(t), 1, 0), t=n^3-n..n^3):
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 17 2013
  • Mathematica
    Table[PrimePi[n^3] - PrimePi[n^3 - n], {n, 100}] (* Alonso del Arte, Mar 17 2013 *)
  • PARI
    default(primelimit,10^7);
    a(n) = primepi(n^3) - primepi(n^3-n);
    /* Joerg Arndt, Mar 16 2013 */

Formula

a(n) = A000720(n^3) - A000720(n^3-n).

A159803 Number of primes p with (2m+1)^2 - 2m <= p < (2m+1)^2.

Original entry on oeis.org

1, 1, 2, 2, 1, 3, 2, 3, 4, 4, 3, 5, 3, 5, 4, 4, 5, 2, 6, 4, 4, 7, 3, 8, 5, 7, 6, 5, 7, 8, 10, 5, 8, 7, 10, 8, 7, 10, 9, 7, 10, 9, 13, 10, 11, 11, 11, 11, 11, 12, 9, 9, 11, 14, 12, 11, 12, 12, 11, 15, 12, 11, 14, 12, 12, 14, 15, 12, 15, 14, 17, 18, 20, 18, 17, 14, 18, 12, 15, 15, 15, 14, 21
Offset: 1

Views

Author

Ulrich Krug (leuchtfeuer37(AT)gmx.de), Apr 22 2009

Keywords

Comments

1) Immediate connection to unsolved problem, is there always a prime between n^2 and (n+1)^2 ("full" interval of two consecutive squares).
2) See sequence A145354 and A157884 for more details to this new improved conjecture.
3) Second ("right") half interval: number of primes p with (2m+1)^2-2m <= p < (2m+1)^2.
4) It is conjectured that a(m) >= 1.
5) No a(m) with m>5 is known, where a(m)=1.
This is a bisection of A094189 and hence related to a conjecture of Oppermann. - T. D. Noe, Apr 22 2009

Examples

			1) m=1: 7 <= p < 9 => prime 7: a(1)=1.
2) m=2: 21 <= p < 25 => prime 23: a(2)=1.
3) m=3: 43 <= p < 49 => primes 43, 47: a(3)=2.
4) m=30: 3661 <= p < 3721 => primes 3671,3673,3677,3691,3697,3701,3709,3719: a(30)=8.
		

References

  • L. E. Dickson, History of the Theory of Numbers, Vol, I: Divisibility and Primality, AMS Chelsea Publ., 1999
  • R. K. Guy, Unsolved Problems in Number Theory (2nd ed.) New York: Springer-Verlag, 1994
  • P. Ribenboim, The New Book of Prime Number Records. Springer. 1996

Crossrefs

Programs

  • Maple
    A159803 := proc(n) local a,p; a := 0 ; for p from 4*n^2+2*n+1 to 4*n^2+4*n do if isprime(p) then a := a+1 ; fi; od: a ; end: seq(A159803(n),n=1..120) ; # R. J. Mathar, Apr 22 2009

Extensions

More terms from R. J. Mathar, Apr 22 2009

A159805 Number of primes p with (2m)^2-(2m-1) <= p < (2m)^2.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 2, 4, 3, 3, 4, 4, 4, 4, 5, 4, 5, 6, 5, 6, 5, 7, 7, 4, 10, 5, 5, 10, 8, 6, 7, 5, 7, 5, 7, 10, 7, 10, 12, 11, 10, 7, 11, 10, 10, 10, 12, 8, 9, 11, 9, 9, 8, 9, 15, 15, 9, 14, 11, 14, 17, 11, 11, 10, 17, 14, 15, 13, 17, 17, 13, 12, 16, 13, 20, 17, 11, 14, 14, 17, 16, 17, 16
Offset: 1

Views

Author

Ulrich Krug (leuchtfeuer37(AT)gmx.de), Apr 22 2009

Keywords

Comments

1) Immediate connection to unsolved problem, is there always a prime between n^2 and (n+1)^2 ("full" interval of two consecutive squares).
2) See sequence A145354 and A157884 for more details to this new improved conjecture.
3) Second ("right") half-interval: number of primes p with (2m)^2-(2m-1) <= p < (2m)^2.
4) It is conjectured that a(m) >= 1.
5) No a(m) with m > 5 is known, where a(m)=1.
Except for a(1), this is a bisection of A094189 and hence related to a conjecture of Oppermann. - T. D. Noe, Apr 22 2009

Examples

			m=1: 3 <= p < 4 => prime 3: a(1)=1;
m=4: 57 <= p < 64 => primes 59,61: a(4)=2;
m=5: 91 <= p < 100 => prime 97: a(5)=1;
m=30: 3541 <= p < 3600 => primes 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593: a(30)=8.
		

References

  • L. E. Dickson, History of the Theory of Numbers, Vol, I: Divisibility and Primality, AMS Chelsea Publ., 1999
  • R. K. Guy, Unsolved Problems in Number Theory (2nd ed.) New York: Springer-Verlag, 1994
  • P. Ribenboim, The New Book of Prime Number Records. Springer, 1996

Crossrefs

Programs

  • Maple
    A159805 := proc(n) local a,p; a := 0 ; for p from 4*n^2-2*n+1 to 4*n^2-1 do if isprime(p) then a := a+1 ; fi; od: a ; end: seq(A159805(n),n=1..120) ; # R. J. Mathar, Apr 22 2009

Extensions

More terms from R. J. Mathar, Apr 22 2009

A217721 Number of primes between n^2 - log_2(n)^2 and n^2 (inclusive).

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Mar 21 2013

Keywords

Comments

Conjecture: a(n) > 0 for n > 1.
Conjecture checked up to n = 2^28 - 1.

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Range[n^2, n^2 - Log[2, n]^2, -1], PrimeQ]], {n, 100}] (* T. D. Noe, Mar 21 2013 *)
  • Python
    import math
    def isprime(k):
      s = 3
      while s*s <= k:
        if k%s==0:  return 0
        s+=2
      return 1
    for n in range(1, 333):
      c = 0
      top = n*n
      for i in range(top - int(math.log(n, 2)**2), top):
        if i&1:  c += isprime(i)
      print(str(c), end=', ')

A362663 a(n) is the partial sum of b(n), which is defined to be the difference between the numbers of primes in (n^2, n^2 + n] and in (n^2 - n, n^2].

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 2, 2, 2, 5, 6, 6, 6, 6, 8, 10, 8, 6, 5, 5, 5, 6, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 7, 7, 7, 9, 10, 10, 10, 13, 14, 13, 16, 15, 14, 14, 17, 17, 15, 17, 17, 16, 16, 18, 18, 20, 22, 18, 19, 19, 18, 19, 17, 19, 25, 27, 27, 30, 31, 37, 35, 35, 34, 34
Offset: 1

Views

Author

Ya-Ping Lu, Apr 29 2023

Keywords

Comments

A plot of a(n) for n up to 100000 is given in Links. First negative term is a(177) = -7 and first zero term appears at n = 198.

Examples

			a(1) =        primepi(1^2+1) + primepi(1^2-1) - 2*primepi(1^2) =   1+0-2*0 = 1.
a(2) = a(1) + primepi(2^2+2) + primepi(2^2-2) - 2*primepi(2^2) = 1+3+1-2*2 = 1.
a(3) = a(2) + primepi(3^2+3) + primepi(3^2-3) - 2*primepi(3^2) = 1+5+3-2*4 = 1.
a(4) = a(3) + primepi(4^2+4) + primepi(4^2-4) - 2*primepi(4^2) = 1+8+5-2*6 = 2.
		

Crossrefs

Programs

  • PARI
    a(n) = sum(i=1, n, primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)); \\ Michel Marcus, May 24 2023
  • Python
    from sympy import primerange; a0 = 0; L = []
    def ct(m1, m2): return len(list(primerange(m1, m2)))
    for n in range(1,75): s = n*n; a = a0+ct(s,s+n+1)-ct(s-n+1,s); L.append(a); a0 = a
    print(*L, sep = ", ")
    

Formula

a(n) = a(n-1) + primepi(n^2+n) + primepi(n^2-n) - 2*primepi(n^2).
a(n) = Sum_{i=1..n} (primepi(i^2+i) + primepi(i^2-i) - 2*primepi(i^2)).
a(n) = 2 + Sum_{i=2..n} (A089610(i) - A094189(i)), for n >= 2.
a(A192391(m)) = a(A192391(m)-1), for m >= 2.
Showing 1-7 of 7 results.