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.

A010051 Characteristic function of primes: 1 if n is prime, else 0.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The following sequences all have the same parity (with an extra zero term at the start of a(n)): a(n), A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
Hardy and Wright prove that the real number 0.011010100010... is irrational. See Nasehpour link. - Michel Marcus, Jun 21 2018
The spectral components (excluding the zero frequency) of the Fourier transform of the partial sequences {a(j)} with j=1..n and n an even number, exhibit a remarkable symmetry with respect to the central frequency component at position 1 + n/4. See the Fourier spectrum of the first 2^20 terms in Links, Comments in A289777, and Conjectures in A001223 of Sep 01 2019. It also appears that the symmetry grows with n. - Andres Cicuttin, Aug 23 2020

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 3.
  • V. Brun, Über das Goldbachsche Gesetz und die Anzahl der Primzahlpaare, Arch. Mat. Natur. B, 34, no. 8, 1915.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Oxford University Press, London, 1975.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 65.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 132.

Crossrefs

Cf. A051006 (constant 0.4146825... (base 10) = 0.01101010001010001010... (base 2)), A001221 (inverse Moebius transform), A143519, A156660, A156659, A156657, A059500, A053176, A059456, A072762.
First differences of A000720, so A000720 gives partial sums.
Column k=1 of A117278.
Characteristic function of A000040.
Cf. A008683.

Programs

  • Haskell
    import Data.List (unfoldr)
    a010051 :: Integer -> Int
    a010051 n = a010051_list !! (fromInteger n-1)
    a010051_list = unfoldr ch (1, a000040_list) where
       ch (i, ps'@(p:ps)) = Just (fromEnum (i == p),
                                  (i + 1, if i == p then ps else ps'))
    -- Reinhard Zumkeller, Apr 17 2012, Sep 15 2011
    
  • Magma
    s:=[]; for n in [1..100] do if IsPrime(n) then s:=Append(s,1); else s:=Append(s,0); end if; end for; s;
    
  • Magma
    [IsPrime(n) select 1 else 0: n in [1..100]];  // Bruno Berselli, Mar 02 2011
    
  • Maple
    A010051:= n -> if isprime(n) then 1 else 0 fi;
  • Mathematica
    Table[ If[ PrimeQ[n], 1, 0], {n, 105}] (* Robert G. Wilson v, Jan 15 2005 *)
    Table[Boole[PrimeQ[n]], {n, 105}] (* Alonso del Arte, Aug 09 2011 *)
    Table[PrimePi[n] - PrimePi[n-1], {n,50}] (* G. C. Greubel, Jan 05 2017 *)
  • PARI
    a(n)=isprime(n) \\ Charles R Greathouse IV, Apr 16 2011
    
  • Python
    from sympy import isprime
    def A010051(n): return int(isprime(n)) # Chai Wah Wu, Jan 20 2022

Formula

a(n) = floor(cos(Pi*((n-1)! + 1)/n)^2) for n >= 2. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 07 2002
Let M(n) be the n X n matrix m(i, j) = 0 if n divides ij + 1, m(i, j) = 1 otherwise; then for n > 0 a(n) = -det(M(n)). - Benoit Cloitre, Jan 17 2003
n >= 2, a(n) = floor(phi(n)/(n - 1)) = floor(A000010(n)/(n - 1)). - Benoit Cloitre, Apr 11 2003
a(n) = Sum_{d|gcd(n, A034386(n))} mu(d). [Brun]
a(m*n) = a(m)*0^(n - 1) + a(n)*0^(m - 1). - Reinhard Zumkeller, Nov 25 2004
a(n) = 1 if n has no divisors other than 1 and n, and 0 otherwise. - Jon Perry, Jul 02 2005
Dirichlet generating function: Sum_{n >= 1} a(n)/n^s = primezeta(s), where primezeta is the prime zeta function. - Franklin T. Adams-Watters, Sep 11 2005
a(n) = (n-1)!^2 mod n. - Franz Vrabec, Jun 24 2006
a(n) = A047886(n, 1). - Reinhard Zumkeller, Apr 15 2008
Equals A051731 (the inverse Möbius transform) * A143519. - Gary W. Adamson, Aug 22 2008
a(n) = A051731((n + 1)! + 1, n) from Wilson's theorem: n is prime if and only if (n + 1)! is congruent to -1 mod n. - N-E. Fahssi, Jan 20 2009, Jan 29 2009
a(n) = A166260/A001477. - Mats Granvik, Oct 10 2009
a(n) = 0^A070824, where 0^0=1. - Mats Granvik, Gary W. Adamson, Feb 21 2010
It appears that a(n) = (H(n)*H(n + 1)) mod n, where H(n) = n!*Sum_{k=1..n} 1/k = A000254(n). - Gary Detlefs, Sep 12 2010
Dirichlet generating function: log( Sum_{n >= 1} 1/(A112624(n)*n^s) ). - Mats Granvik, Apr 13 2011
a(n) = A100995(n) - sqrt(A100995(n)*A193056(n)). - Mats Granvik, Jul 15 2011
a(n) * (2 - n mod 4) = A151763(n). - Reinhard Zumkeller, Oct 06 2011
(n - 1)*a(n) = ( (2*n + 1)!! * Sum_{k=1..n}(1/(2*k + 1))) mod n, n > 2. - Gary Detlefs, Oct 07 2011
For n > 1, a(n) = floor(1/A001222(n)). - Enrique Pérez Herrero, Feb 23 2012
a(n) = mu(n) * Sum_{d|n} mu(d)*omega(d), where mu is A008683 and omega A001222 or A001221 indistinctly. - Enrique Pérez Herrero, Jun 06 2012
a(n) = A003418(n+1)/A003418(n) - A217863(n+1)/A217863(n) = A014963(n) - A072211(n). - Eric Desbiaux, Nov 25 2012
For n > 1, a(n) = floor(A014963(n)/n). - Eric Desbiaux, Jan 08 2013
a(n) = ((abs(n-2))! mod n) mod 2. - Timothy Hopper, May 25 2015
a(n) = abs(F(n)) - abs(F(n)-1/2) - abs(F(n)-1) + abs(f(n)-3/2), where F(n) = Sum_{m=2..n+1} (abs(1 - (n mod m)) - abs(1/2 - (n mod m)) + 1/2), n > 0. F(n) = 1 if n is prime, > 1 otherwise, except F(1) = 0. a(n) = 1 if F(n) = 1, 0 otherwise. - Timothy Hopper, Jun 16 2015
For n > 4, a(n) = (n-2)! mod n. - Thomas Ordowski, Jul 24 2016
From Ilya Gutkovskiy, Jul 24 2016: (Start)
G.f.: A(x) = Sum_{n>=1} x^A000040(n) = B(x)*(1 - x), where B(x) is the g.f. for A000720.
a(n) = floor(2/A000005(n)), for n>1. (End)
a(n) = pi(n) - pi(n-1) = A000720(n) - A000720(n-1), for n>=1. - G. C. Greubel, Jan 05 2017
Decimal expansion of Sum_{k>=1} (1/10)^prime(k) = 9 * Sum_{k>=1} pi(k)/10^(k+1), where pi(k) = A000720(k). - Amiram Eldar, Aug 11 2020
a(n) = 1 - ceiling((2/n) * Sum_{k=2..floor(sqrt(n))} floor(n/k)-floor((n-1)/k)), n>1. - Gary Detlefs, Sep 08 2023
a(n) = Sum_{d|n} mu(d)*omega(n/d), where mu = A008683 and omega = A001221. - Ridouane Oudra, Apr 12 2025
a(n) = 0 if (n^2 - 3*n + 2) * A000203(n) - 8 * A002127(n) > 0 else 1 (n>2, see Craig link). - Bill McEachen, Jul 04 2025

A060208 a(n) = 2*pi(n) - pi(2*n), where pi(i) = A000720(i).

Original entry on oeis.org

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

Views

Author

Labos Elemer, Mar 19 2001

Keywords

Comments

Rosser & Schoenfeld show 2*pi(x) > pi(2*x) for x > 10. - N. J. A. Sloane, Jul 03 2013, corrected Jul 09 2015

Examples

			n=100, pi(100)=25, pi(200)=46, 2pi(100)-pi(2*100) =4=a(100)
		

References

  • J. Barkley Rosser and Lowell Schoenfeld, Abstracts of Scientific Communications, Internat. Congress Math., Moscow, 1966, Section 3, Theory of Numbers.
  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section VII.5, p. 235.
  • Sanford Segal, On Pi(x+y)<=Pi(x)+Pi(y). Transactions American Mathematical Society, 104 (1962), 523-527.

Crossrefs

Programs

  • Magma
    [2*#PrimesUpTo(n) -#PrimesUpTo(2*n): n in [1..200]]; // G. C. Greubel, Aug 01 2024
    
  • Mathematica
    f[n_] := 2 PrimePi[n] - PrimePi[2 n]; Array[f, 122] (* Robert G. Wilson v, Aug 12 2011 *)
  • PARI
    a(n)=2*primepi(n)-primepi(2*n) \\ Charles R Greathouse IV, Jul 02 2013
    
  • SageMath
    [2*prime_pi(n) -prime_pi(2*n) for n in range(1,201)] # G. C. Greubel, Aug 01 2024

Formula

a(n) = Mod[2*PrimePi[n], PrimePi[2n]] = 2*A000720(n) - A000720(2n) for n>1.
a(n) ~ 2n log 2 / (log n)^2, by the prime number theorem. - N. J. A. Sloane, Mar 12 2007
a(n) = -A047886(n,n) (see A212210 to A212213). - Reinhard Zumkeller, Apr 15 2008

Extensions

Edited by N. J. A. Sloane, Jul 03 2013

A212210 Triangle read by rows: T(n,k) = pi(n) + pi(k) - pi(n+k), n >= 1, 1 <= k <= n, where pi() = A000720().

Original entry on oeis.org

-1, -1, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1, 1, 2, -1, 0, 1, 1, 1, 1, 0, 1, 2, 1, 2, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 0, 0, 1, 0, 1, 1, 2, 1, 1, -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 2, 1, 2, 1, 1, 1, 2, -1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 3, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 3, 3
Offset: 1

Views

Author

N. J. A. Sloane, May 04 2012

Keywords

Comments

It is conjectured that pi(x)+pi(y) >= pi(x+y) for 1 < y <= x.
A006093 gives row numbers of rows containing at least one negative term. [Reinhard Zumkeller, May 05 2012]

Examples

			Triangle begins:
  -1
  -1 0
   0 0 1
  -1 0 0 0
   0 0 1 1 2
  -1 0 1 1 1 1
   0 1 2 1 2 1 2
   0 1 1 1 1 1 2 2
   0 0 1 0 1 1 2 1 1
  -1 0 0 0 1 1 1 1 0 0
  ...
		

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section VII.5, p. 235.

Crossrefs

Programs

  • Haskell
    import Data.List (inits, tails)
    a212210 n k = a212210_tabl !! (n-1) !! (k-1)
    a212210_row n = a212210_tabl !! (n-1)
    a212210_tabl = f $ tail $ zip (inits pis) (tails pis) where
       f ((xs,ys) : zss) = (zipWith (-) (map (+ last xs) (xs)) ys) : f zss
       pis = a000720_list
    -- Reinhard Zumkeller, May 04 2012
  • Mathematica
    t[n_, k_] := PrimePi[n] + PrimePi[k] - PrimePi[n + k]; Table[t[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 17 2012 *)

A212213 Array read by antidiagonals: pi(n) + pi(k) - pi(n+k), where pi() = A000720.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 04 2012

Keywords

Comments

It is conjectured that pi(x) + pi(y) >= pi(x+y) for 1 < y <= x.

Examples

			Array begins:
  0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, ...
  0, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, ...
  0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, ...
  0, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, ...
  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, ...
  1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, ...
  ...
		

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section VII.5, p. 235.

Crossrefs

Programs

  • Mathematica
    t[n_, k_] := PrimePi[n] + PrimePi[k] - PrimePi[n + k]; Table[t[n - k + 2, k], {n, 0, 15}, {k, 2, n}] // Flatten (* Jean-François Alcover, Dec 31 2012 *)

A047885 Array a(m,n) = pi(m+n) - pi(m) - pi(n) read by antidiagonals, where pi() = A000720 (m,n >= 0).

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -2, -1, -2, -1, -2, -1, 0, 0
Offset: 0

Views

Author

Keywords

Comments

A212210-A212213 are the preferred versions of this array.

Examples

			Beginning of array is
  0  0  0  0  0  0  0  0 ...
  0  1  1  0  1  0  1  0 ...
  0  1  0  0  0  0 -1 ...
  0  0  0 -1  0 -1 -1 ...
  ...
		

Crossrefs

A212212 Array read by antidiagonals: pi(n) + pi(k) - pi(n+k), where pi() = A000720.

Original entry on oeis.org

-1, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 2, 1, 2, 1, 2, 1, 0, -1, 0, 1, 1, 1, 1, 1, 1, 0, -1, 0, 0, 1, 1, 2, 1, 2, 1, 1, 0, 0, -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, -1, 0, 0, 1, 0, 1, 1, 2, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 0
Offset: 1

Views

Author

N. J. A. Sloane, May 04 2012

Keywords

Comments

It is conjectured that pi(x) + pi(y) >= pi(x+y) for 1 < y <= x.

Examples

			Array begins:
  -1, -1,  0, -1,  0, -1,  0,  0,  0, -1,  0, -1, ...
  -1,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0, ...
   0,  0,  1,  0,  1,  1,  2,  1,  1,  0,  1,  1, ...
  -1,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1, ...
   0,  0,  1,  1,  2,  1,  2,  1,  1,  1,  2,  1, ...
  -1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1, ...
   0,  1,  2,  1,  2,  1,  2,  2,  2,  1,  2,  1, ...
   0,  1,  1,  1,  1,  1,  2,  2,  1,  1,  1,  1, ...
   ...
		

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section VII.5, p. 235.

Crossrefs

Cf. A000720, A212210-A212213, A060208, A047885, A047886. First row and column are -A010051.

Programs

  • Mathematica
    a[n_, k_] := PrimePi[n] + PrimePi[k] - PrimePi[n+k]; Flatten[ Table[a[n-k, k], {n, 1, 15}, {k, 1, n-1}]] (* Jean-François Alcover, Jul 18 2012 *)

A212211 Triangle read by rows: T(n,k) = pi(n) + pi(k) - pi(n+k), n >= 2, 2 <= k <= n, where pi() = A000720().

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 04 2012

Keywords

Comments

It is conjectured that pi(x) + pi(y) >= pi(x+y) for 1 < y <= x.

Examples

			Triangle begins:
  0,
  0, 1,
  0, 0, 0,
  0, 1, 1, 2,
  0, 1, 1, 1, 1,
  1, 2, 1, 2, 1, 2,
  1, 1, 1, 1, 1, 2, 2,
  0, 1, 0, 1, 1, 2, 1, 1,
  0, 0, 0, 1, 1, 1, 1, 0, 0,
  0, 1, 1, 2, 1, 2, 1, 1, 1, 2,
  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  ...
		

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section VII.5, p. 235.

Crossrefs

Programs

  • Haskell
    a212211 n k = a212211_tabl !! (n-2) !! (k-2)
    a212211_tabl = map a212211_row [2..]
    a212211_row n = zipWith (-)
       (map (+ a000720 n) $ take (n - 1) $ tail a000720_list)
       (drop (n + 1) a000720_list)
    -- Reinhard Zumkeller, May 04 2012
  • Mathematica
    t[n_, k_] := PrimePi[n] + PrimePi[k] - PrimePi[n+k]; Flatten[ Table[t[n, k], {n, 2, 13}, {k, 2, n}]] (* Jean-François Alcover, May 21 2012 *)
Showing 1-7 of 7 results.