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

A062298 Number of nonprimes <= n.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 9, 10, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 42, 43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53
Offset: 1

Views

Author

Amarnath Murthy, Jun 19 2001

Keywords

Comments

a(n) = n - A000720(n). This is asymptotic to n - Li(n). Note that a(n) + A095117(n) = 2*n. - Jonathan Vos Post, Nov 22 2004
Same as number of primes between n and prime(n+1) and between n and prime(n)+1 (end points excluded); n prime -> a(n)=a(n-1), n composite-> a(n)=1+a(n-1). - David James Sycamore, Jul 23 2018
There exists at least one prime number between a(n) and n for n >= 3 (see the paper by Ya-Ping Lu attached in the links). - Ya-Ping Lu, Nov 27 2020

Examples

			a(19) = 11 as there are 8 primes up to 19 (inclusive).
		

Crossrefs

Programs

  • Haskell
    a062298 n = a062298_list !! (n-1)
    a062298_list = scanl1 (+) $ map (1 -) a010051_list
    -- Reinhard Zumkeller, Oct 10 2013
    
  • Magma
    [n - #PrimesUpTo(n): n in [1..100]]; // Vincenzo Librandi, Aug 05 2015
    
  • Maple
    NumComposites := proc(N::posint) local count, i:count := 0:for i from 1 to N do if not isprime(i) then count := count + 1 fi:od: count;end:seq(NumComposites(binomial(k+1,k)), k=0..73); # Zerinvary Lajos, May 26 2008
    A062298 := proc(n) n-numtheory[pi](n) ; end: seq(A062298(n),n=1..120) ; # R. J. Mathar, Sep 27 2009
  • Mathematica
    Table[n-PrimePi[n],{n,80}] (* Harvey P. Dale, May 10 2012 *)
    Accumulate[Table[If[PrimeQ[n],0,1],{n,100}]] (* Harvey P. Dale, Feb 15 2017 *)
  • PARI
    a(n) = n-primepi(n); \\ Harry J. Smith, Aug 04 2009
    
  • Python
    from sympy import primepi
    print([n - primepi(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 29 2017

Formula

a(n) = n - A000720(n).
a(n) = 1 + A065855(n). - David James Sycamore, Jul 23 2018

Extensions

Corrected and extended by Vladeta Jovovic, Jun 22 2001

A095117 a(n) = pi(n) + n, where pi(n) = A000720(n) is the number of primes <= n.

Original entry on oeis.org

0, 1, 3, 5, 6, 8, 9, 11, 12, 13, 14, 16, 17, 19, 20, 21, 22, 24, 25, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 39, 40, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 76, 77, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 91
Offset: 0

Views

Author

Dean Hickerson, following a suggestion of Leroy Quet, May 28 2004

Keywords

Comments

Positions of first occurrences of n in A165634: A165634(a(n))=n for n>0. - Reinhard Zumkeller, Sep 23 2009
There exists at least one prime number p such that n < p <= a(n) for n >= 2. For example, 2 is in (2, 3], 5 in (3, 5], 5 in (4, 6], ..., and primes 73, 79, 83 and 89 are in (71, 91] (see Corollary 1 in the paper by Ya-Ping Lu attached in the links section). - Ya-Ping Lu, Feb 21 2021

Crossrefs

Complement of A095116.

Programs

  • Haskell
    a095117 n = a000720 n + toInteger n  -- Reinhard Zumkeller, Apr 17 2012
    
  • Maple
    with(numtheory): seq(n+pi(n),n=1..90); # Emeric Deutsch, May 02 2007
  • Mathematica
    Table[ PrimePi@n + n, {n, 0, 71}] (* Robert G. Wilson v, Apr 22 2007 *)
  • PARI
    a(n) = n + primepi(n); \\ Michel Marcus, Feb 21 2021
    
  • Python
    from sympy import primepi
    def a(n): return primepi(n) + n
    print([a(n) for n in range(72)]) # Michael S. Branicky, Feb 21 2021

Formula

a(0) = 0; for n>0, a(n) = a(n-1) + (if n is prime then 2, else 1). - Robert G. Wilson v, Apr 22 2007; corrected by David James Sycamore, Aug 16 2018

Extensions

Edited by N. J. A. Sloane, Jul 02 2008 at the suggestion of R. J. Mathar

A338521 The number of primes between n-primepi(n) and n.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Nov 01 2020

Keywords

Comments

There is at least one prime number between n-primepi(n) and n, or a(n) >= 1, for n >= 3 (see Corollary 3 in the paper by Ya_Ping Lu attached in the links).

Crossrefs

Programs

  • Mathematica
    Array[Subtract @@ Map[PrimePi, {#1 - 1, #1 - #2}] & @@ {#, PrimePi[#]} &, 105] (* Michael De Vlieger, Nov 05 2020 *)
  • PARI
    a(n) = primepi(n - 1) - primepi(n - primepi(n)); \\ Michel Marcus, Nov 01 2020
  • Python
    from sympy import primepi
    for n in range(1, 101):
        pi = primepi(n)
        pi_1 = primepi(n - 1)
        a = pi_1 - primepi(n - pi)
        print(a)
    

Formula

a(n) = primepi(n - 1) - primepi(n - primepi(n)).
a(n) = A000720(n - 1) - A000720(n - A000720(n)).
a(n) = A000720(n -1) - A000720(A062298(n)).

A339085 Number of primes p with n - pi(n) < p <= n + pi(n), where pi(n) is the number of primes <= n.

Original entry on oeis.org

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

Views

Author

Ya-Ping Lu, Nov 23 2020

Keywords

Comments

a(n) >= 2 if n >= 2 and a(n) >= 3 if n is a prime >= 3 (see the paper by Ya-Ping Lu attached in the links).

Crossrefs

Programs

  • Mathematica
    Table[PrimePi[n+PrimePi[n]]-PrimePi[n-PrimePi[n]],{n,85}] (* Stefano Spezia, Nov 24 2020 *)
  • Python
    from sympy import primepi
    for n in range(1, 101):
        m = primepi(n)
        print (primepi(n + m) - primepi(n - m))

Formula

a(n) = pi(n + pi(n)) - pi(n - pi(n)).
a(n) = A000720(n + A000720(n)) - A000720(n - A000720(n)).
a(n) = A000720(A095117(n)) - A000720(A062298(n)).
a(n) = A337788(n) + A338521(n) + isprime(n), where isprime(n) = 1 (if n is a prime) or 0 (if n is not a prime).

A344117 Number of twin prime pairs in the range (6*n + 1, 6*(n + m) + 1], where m is the number of twin prime pairs, 6*k +- 1 for k = 1, 2, ..., n.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 3, 3, 4, 4, 3, 3, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
Offset: 1

Views

Author

Ya-Ping Lu, Jun 24 2021

Keywords

Comments

Conjecture: a(n) >= 1.

Crossrefs

Programs

  • Python
    from sympy import isprime
    def istwin(m): return 1 if isprime(6*m-1)*isprime(6*m+1) == 1 else 0
    ct1 = 0
    for n in range(1, 100):
        ct1 += istwin(n); ct = 0
        for m in range (n + 1, n + ct1 + 1): ct += istwin(m)
        print(ct)
Showing 1-5 of 5 results.