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

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

Original entry on oeis.org

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

Views

Author

Jason Earls, May 25 2004

Keywords

Comments

Conjecture: for n>11, a(n)>1.
Oppermann conjectured in 1882 that a(n)>0 for n>1. - 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
    a094189 n = sum $ map a010051' [n*(n-1) .. n^2]
    -- Reinhard Zumkeller, Jun 07 2015
  • Mathematica
    Table[PrimePi[n^2]-PrimePi[n^2-n-1],{n,100}] (* Harvey P. Dale, Jul 24 2015 *)
  • PARI
    a(n) = sum(k=n^2-n,n^2,isprime(k))
    
  • PARI
    a(n)=my(s);forprime(p=n^2-n,n^2,s++);s \\ Charles R Greathouse IV, Jan 18 2016
    

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

A216266 Number of primes between n^3 and n^3+n (inclusive).

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Mar 15 2013

Keywords

Comments

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

Crossrefs

Programs

  • Java
    import java.math.BigInteger;
    public class A216266 {
        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+1; k<=cube+n; ++k) {
              BigInteger b1 = BigInteger.valueOf(k);
              if (b1.isProbablePrime(2)) {
                if (b1.isProbablePrime(80))
                  ++c;
              }
            }
            System.out.printf("%d, ", c);
          }
        }
    }
    
  • Maple
    a:= n-> add(`if`(isprime(t), 1, 0), t=n^3..n^3+n):
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 17 2013
  • Mathematica
    Table[PrimePi[n^3+n]-PrimePi[n^3],{n,100}] (* Harvey P. Dale, Apr 19 2014 *)
  • PARI
    default(primelimit,10^7);
    a(n) = primepi(n^3+n) - primepi(n^3);
    /* Joerg Arndt, Mar 16 2013 */

Formula

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

A217317 Number of primes between n^2 and n^2 + log_2(n)^2 (inclusive).

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Mar 20 2013

Keywords

Comments

Indices of zeros: 1, 1165, 4292936, 4765516.
Conjecture: a(n) > 0 for n > 4765516.
Conjecture checked up to n = 5 * 10^10. - Charles R Greathouse IV, Mar 21 2013
Conjecture checked up to 4 * 10^18. Note that this conjecture is consistent with Granville's conjecture that lim sup (prime(n+1)-prime(n))/log(prime(n))^2 >= 2/e^gamma, where gamma is Euler's constant. - Charles R Greathouse IV, Mar 21 2016

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Range[n^2, n^2 + Log[2, n]^2], PrimeQ]], {n, 100}] (* T. D. Noe, Mar 21 2013 *)
    Table[PrimePi[n^2+Log[2,n]^2]-PrimePi[n^2],{n,90}] (* Harvey P. Dale, May 22 2014 *)
  • PARI
    a(n)=sum(i=n^2+1,n^2+(log(n)/log(2))^2,isprime(i)) \\ Charles R Greathouse IV, 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 + int(math.log(n, 2)**2) + 1
      for i in range(n*n+1, top):
        if i&1:  c += isprime(i)
      print(str(c), end=', ')
    

A129000 Start with an integer (in this case, 1). First, add 5 or 8 if the integer is odd or even, respectively. Then divide by 2.

Original entry on oeis.org

1, 3, 4, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7
Offset: 1

Views

Author

Adam F. Schwartz (adam_s(AT)mit.edu), May 01 2007

Keywords

Examples

			a(7) = 6 because (7 + 5)/2 = 6.
		

Crossrefs

Programs

  • Mathematica
    a={1};k=1;For[n=1,n<70,n++,If[EvenQ[k],k=k+8,k=k+5];k=k/2;AppendTo[a, k]]; a (* Stefan Steinerberger, May 26 2007 *)

Formula

a(n) = (a(n-1) + b)/d, if a(n) even = (a(n-1) + c)/d, if a(n) odd (starting with a(1)=1, b=5, c=8, d=2).

Extensions

More terms from Stefan Steinerberger, May 26 2007

A248623 Triangle T(n,k) read by rows, of number of primes in interval [k*n, (k+1)*n] exclusive, n>=k.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1, 2, 1, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 4, 2, 2, 3, 2, 2, 3, 2, 1, 4, 3, 3, 3, 2, 2, 3, 2, 2, 4, 1, 2, 4, 2, 4, 2, 3, 3, 1, 4, 2, 2, 2, 2
Offset: 1

Views

Author

Bob Selcoe, Oct 10 2014

Keywords

Comments

Reading by columns: First column (k=1) is the number of primes in the interval [n,2n], n>=1; second column is the number of primes in the interval [2n,3n], n>=2; third column is the number of primes in the interval [3n,4n], n>=3; etc.
First column (k=1) is A060715.
Proofs exist which state that for n>1, at least one prime is in [n,2n] ("Bertrand's Postulate", first proved by P. Chebyshev), [2n,3n] (proved by El Bachraoui) and [3n,4n] (proved by Loo).
Starting with T(2,1), the falling diagonal of the first 2 numbers in each column (read by column) are the number of primes in [A002620(n), A002620(n+1)], n>=3. That is, the coefficients of T(2,1), T(3,1), T(3,2), T(4,2), T(4,3), T(5,3) etc. are the number of primes between A002620(n) and A002620(n+1), n>=3. This pertains to Oppermann's conjecture, which states there is at least one prime in [n^2, n^2+n] and [n^2+n, (n+1)^2].
The falling diagonal starting with T(2,2) (i.e., the sequence when n=k>=2) is A089610(n).
Except for trivial T(1,1) = 0 (null interval [1,2]) it is conjectured here that at least one prime is in [k*n, (k+1)*n] exclusive, n>=k. That is, all the coefficients in the triangle are positive, except T(1,1).

Examples

			Triangle starts:
  0
  1  1
  1  1  1
  2  1  1  2
  1  2  2  1  1
  2  2  2  1  1  2
  2  2  1  2  2  2  1
  2  3  2  1  2  1  2  2
  3  2  2  3  2  2  2  2  2
  4  2  2  3  2  2  3  2  1  4
  3  3  3  2  2  3  2  2  4  1  2
  4  2  4  2  3  3  1  4  2  2  2  2
T(1,1) = 0.
T(11,9) = 4 because the number of primes in [99,110] is 4: {101, 103, 107, 109}.
		

Crossrefs

Cf. A060715, A002620, A218831, A089610 (related).

Programs

  • Mathematica
    T[n_, k_] := PrimePi[(k+1)n] - PrimePi[n k] - Boole[PrimeQ[(k+1)n]];
    Table[T[n, k], {n, 1, 12}, {k, 1, n}] // Flatten (* Jean-François Alcover, Sep 23 2018, from PARI *)
  • PARI
    tabl(nn) = {for (n=1, nn, for (k=1, n, print1(primepi((k+1)*n) - primepi(n*k) - isprime((k+1)*n), ", ");); print(););} \\ Michel Marcus, Nov 04 2014

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.

A159802 Number of primes q with (2m)^2+1 <= q < (2m+1)^2-2m.

Original entry on oeis.org

1, 2, 2, 2, 4, 2, 2, 4, 2, 3, 4, 4, 4, 4, 4, 5, 4, 7, 6, 8, 5, 4, 7, 7, 6, 9, 7, 7, 6, 8, 7, 9, 7, 10, 11, 7, 10, 12, 9, 6, 9, 8, 8, 8, 9, 8, 10, 10, 12, 11, 11, 12, 13, 9, 12, 14, 13, 11, 10, 14, 11, 14, 15, 12, 16, 14, 16, 11, 12, 11, 12, 14, 14, 15, 15, 13, 17, 15, 16, 18, 17, 15, 12, 12
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) First ("left") half interval, primes q with (2m)^2+1 <= q < (2m+1)^2-2m.
4) It is conjectured that a(m) >= 1.
5) No a(m) with m>1 is known, where a(m)=1.
This is a bisection of A089610 and hence related to a conjecture of Oppermann. - T. D. Noe, Apr 22 2009

Examples

			1) m=1: 5 <= q < 7 => prime 5: a(1)=1.
2) m=2: 17 <= q < 21 => primes 17, 19: a(2)=2.
3) m=3: 37 <= q < 43 => primes 37, 41: a(3)=2.
4) m=30: 3601 <= q < 3661 => primes 3607,3613,3617,3623,3631,3637,3643,3659: 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

  • Mathematica
    f[n_] := PrimePi[(2 n + 1)^2 - 2 n - 1] - PrimePi[(2 n)^2]; Table[ f@n, {n, 85}] (* Robert G. Wilson v, May 04 2009 *)

Extensions

More terms from Robert G. Wilson v, May 04 2009

A159804 Number of primes q with (2n-1)^2+1 <= q < (2n)^2-(2n-1).

Original entry on oeis.org

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

Views

Author

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

Keywords

Comments

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

Examples

			n=1: 2 <= q < 3 => prime 2: a(1)=1;
n=5: 82 <= q < 91 => primes 83,89: a(5)=2;
n=9: 290 <= q < 307 => prime 293: a(9)=1;
n=30: 3482 <= q < 3541 => prime 3491,3499,3511,3517,3527,3529,3533,3539: 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

  • PARI
    a(n) = if (n==1, 1, primepi((2*n)^2-(2*n-1)-1) - primepi((2*n-1)^2+1)); \\ Michel Marcus, May 18 2020

Extensions

More terms from Michel Marcus, May 18 2020
Showing 1-9 of 9 results.