

A000040


The prime numbers.
(Formerly M0652 N0241)


10416



2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

See A065091 for comments, formulas etc. concerning only odd primes. For all information concerning prime powers, see A000961. For contributions concerning "almost primes" see A002808.
A number p is prime if (and only if) it is greater than 1 and has no positive divisors except 1 and p.
A natural number is prime if and only if it has exactly two (positive) divisors.
A prime has exactly one proper positive divisor, 1.
The paper by Kaoru Motose starts as follows: "Let q be a prime divisor of a Mersenne number 2^p1 where p is prime. Then p is the order of 2 (mod q). Thus p is a divisor of q  1 and q > p. This shows that there exist infinitely many prime numbers."  Pieter Moree, Oct 14 2004
1 is not a prime, for if the primes included 1, then the factorization of a natural number n into a product of primes would not be unique, since n = n*1.
Prime(n) and pi(n) are inverse functions: A000720(a(n)) = n and a(n) is the least number m such that a(A000720(m)) = a(n). a(A000720(n)) = n if (and only if) n is prime.
Second sequence ever computed by electronic computer, on EDSAC, May 09 1949 (see Renwick link).  Russ Cox, Apr 20 2006
A number n is prime if and only if it is different from zero and different from a unit and each multiple of n decomposes into factors such that n divides at least one of the factors. This applies equally to the integers (where a prime has exactly four divisors (the definition of divisors is relaxed such that they can be negative)) and the positive integers (where a prime has exactly two distinct divisors).  Peter Luschny, Oct 09 2012
Motivated by his conjecture on representations of integers by alternating sums of consecutive primes, for any positive integer n, ZhiWei Sun conjectured that the polynomial P_n(x) = Sum_{k=0..n} a(k+1)*x^k is irreducible over the field of rational numbers with the Galois group S_n, and moreover P_n(x) is irreducible mod a(m) for some m <= n(n+1)/2. It seems that no known criterion on irreduciblity of polynomials implies this conjecture.  ZhiWei Sun, Mar 23 2013
Natural numbers such that there is exactly one base b such that the baseb alternate digital sum is 0 (see A239707).
Equivalently: Numbers p > 1 such that b = p1 is the only base >= 1 for which the baseb alternate digital sum is 0.
Equivalently: Numbers p > 1 such that the baseb alternate digital sum is <> 0 for all bases 1 <= b < p1. (End)
An integer n > 1 is a prime if and only if it is not the sum of positive integers in arithmetic progression with common difference 2.  JeanChristophe Hervé, Jun 01 2014
Conjecture: Numbers having prime factors <= prime(n+1) are {kk^f(n) mod primorial(n)=1}, where f(n) = lcm(prime(i)1, i=1..n) = A058254(n) and primorial(n) = A002110(n). For example, numbers with no prime divisor <= prime(7) = 17 are {kk^60 mod 30030=1}.  Gary Detlefs, Jun 07 2014
Cramer conjecture prime(n+1)  prime(n) < C log^2 prime(n) is equivalent to the inequality (log prime(n+1)/log prime(n))^n < e^C, as n tend to infinity, where C is an absolute constant.  Thomas Ordowski, Oct 06 2014
I conjecture that for any positive rational number r there are finitely many primes q_1,...,q_k such that r = Sum_{j=1..k} 1/(q_j1). For example, 2 = 1/(21) + 1/(31) + 1/(51) + 1/(71) + 1/(131) with 2, 3, 5, 7 and 13 all prime, 1/7 = 1/(131) + 1/(291) + 1/(431) with 13, 29 and 43 all prime, and 5/7 = 1/(31) + 1/(71) + 1/(311) + 1/(711) with 3, 7, 31 and 71 all prime.  ZhiWei Sun, Sep 09 2015
I also conjecture that for any positive rational number r there are finitely many primes p_1,...,p_k such that r = Sum_{j=1..k} 1/(p_j+1). For example, 1 = 1/(2+1) + 1/(3+1) + 1/(5+1) + 1/(7+1) + 1/(11+1) + 1/(23+1) with 2, 3, 5, 7, 11 and 23 all prime, and 10/11 = 1/(2+1) + 1/(3+1) + 1/(5+1) + 1/(7+1) + 1/(43+1) + 1/(131+1) + 1/(263+1) with 2, 3, 5, 7, 43, 131 and 263 all prime.  ZhiWei Sun, Sep 13 2015
Numbers k such that ((k2)!!)^2 == +1 (mod k).  Thomas Ordowski, Aug 27 2016
Does not satisfy Benford's law [Diaconis, 1977; CohenKatz, 1984; BergerHill, 2017].  N. J. A. Sloane, Feb 07 2017
Prime numbers are the integer roots of 1  sin(Pi*Gamma(s)/s)/sin(Pi/s).  Peter Luschny, Feb 23 2018
Conjecture: log log a(n+1)  log log a(n) < 1/n.  Thomas Ordowski, Feb 17 2023


REFERENCES

M. Aigner and G. M. Ziegler, Proofs from The Book, SpringerVerlag, Berlin, 2nd. ed., 2001; see p. 3.
T. M. Apostol, Introduction to Analytic Number Theory, SpringerVerlag, 1976, page 2.
E. Bach and Jeffrey Shallit, Algorithmic Number Theory, I, Chaps. 8, 9.
D. M. Bressoud, Factorization and Primality Testing, SpringerVerlag NY 1989.
M. Cipolla, "La determinazione asintotica dell'nmo numero primo.", Rend. d. R. Acc. di sc. fis. e mat. di Napoli, s. 3, VIII (1902), pp. 132166.
R. Crandall and C. Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 1.
Martin Davis, "Algorithms, Equations, and Logic", pp. 415 of S. Barry Cooper and Andrew Hodges, Eds., "The Once and Future Turing: Computing the World", Cambridge 2016.
J.P. Delahaye, Merveilleux nombres premiers, Pour la ScienceBelin Paris, 2000.
J.P. Delahaye, Savoir si un nombre est premier: facile, Pour La Science, 303(1) 2003, pp. 98102.
Diaconis, Persi, The distribution of leading digits and uniform distribution mod 1, Ann. Probability, 5, 1977, 7281,
M. Dietzfelbinger, Primality Testing in Polynomial Time, Springer NY 2004.
M. du Sautoy, The Music of the Primes, Fourth Estate / HarperCollins, 2003; see p. 5.
J. Elie, "L'algorithme AKS", in 'Quadrature', No. 60, pp. 2232, 2006 EDPsciences, Les Ulis (France);
W. & F. Ellison, Prime Numbers, Hermann Paris 1985
T. Estermann, Introduction to Modern Prime Number Theory, Camb. Univ. Press, 1969.
J. M. Gandhi, Formulae for the nth prime. Proc. Washington State Univ. Conf. on Number Theory, 96106. Wash. St. Univ., Pullman, Wash., 1971.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 2.
Peter Hilton and Jean Pedersen, A Mathematical Tapestry: Demonstrating the Beautiful Unity of Mathematics, Cambridge University Press, 2010, pp. (260264).
H. D. Huskey, Derrick Henry Lehmer [19051991]. IEEE Ann. Hist. Comput. 17 (1995), no. 2, 6468. Math. Rev. 96b:01035, cf. http://www.ams.org/mathscinetgetitem?mr=1336709
M. N. Huxley, The Distribution of Prime Numbers, Oxford Univ. Press, 1972.
D. S. Jandu, Prime Numbers And Factorization, Infinite Bandwidth Publishing, N. Hollywood CA 2007.
E. Landau, Handbuch der Lehre von der Verteilung der Primzahlen, Chelsea, NY, 1974.
D. H. Lehmer, The sieve problem for allpurpose computers. Math. Tables and Other Aids to Computation, Math. Tables and Other Aids to Computation, 7, (1953). 614. Math. Rev. 14:691e
D. N. Lehmer, "List of Prime Numbers from 1 to 10,006,721", Carnegie Institute, Washington, D.C. 1909.
W. J. LeVeque, Topics in Number Theory. AddisonWesley, Reading, MA, 2 vols., 1956, Vol. 1, Chap. 6.
H. Lifchitz, Table des nombres premiers de 0 à 20 millions (Tomes I & II), Albert Blanchard, Paris 1971.
R. F. Lukes, C. D. Patterson and H. C. Williams, Numerical sieving devices: their history and some applications. Nieuw Arch. Wisk. (4) 13 (1995), no. 1, 113139. Math. Rev. 96m:11082, cf http://www.ams.org/mathscinetgetitem?mr=96m:11082
P. Ribenboim, The New Book of Prime Number Records, SpringerVerlag NY 1995.
P. Ribenboim, The Little Book of Bigger Primes, SpringerVerlag NY 2004.
H. Riesel, Prime Numbers and Computer Methods for Factorization, Birkhäuser Boston, Cambridge MA 1994.
B. Rittaud, "31415879. Ce nombre estil premier?" ['Is this number prime?'], La Recherche, Vol. 361, pp. 7073, Feb 15 2003, Paris.
D. Shanks, Solved and Unsolved Problems in Number Theory, 2nd. ed., Chelsea, 1978, Chap. 1.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
D. Wells, Prime Numbers: The Most Mysterious Figures In Math, J. Wiley NY 2005.
H. C. Williams and Jeffrey Shallit, Factoring integers before computers. Mathematics of Computation 19431993: a halfcentury of computational mathematics (Vancouver, BC, 1993), 481531, Proc. Sympos. Appl. Math., 48, AMS, Providence, RI, 1994. Math. Rev. 95m:11143


LINKS

C. K. Caldwell and Y. Xiong, What is the smallest prime?, J. Integer Seq. 15 (2012), no. 9, Article 12.9.7 and arXiv:1209.2007 [math.HO], 2012.
E. Landau, Handbuch der Lehre von der Verteilung der Primzahlen, vol. 1 and vol. 2, Leipzig, Berlin, B. G. Teubner, 1909.
Popular Computing (Calabasas, CA), Sieves: Problem 43, Vol. 2 (No. 13, Apr 1974), pp. 67. [Annotated and scanned copy]


FORMULA

The prime number theorem is the statement that a(n) ~ n * log n as n > infinity (Hardy and Wright, page 10).
For n >= 2, n*(log n + log log n  3/2) < a(n); for n >= 20, a(n) < n*(log n + log log n  1/2). [Rosser and Schoenfeld]
For all n, a(n) > n log n. [Rosser]
n log(n) + n (log log n  1) < a(n) < n log n + n log log n for n >= 6. [Dusart, quoted in the Wikipedia article]
a(n) = n log n + n log log n + (n/log n)*(log log n  log n  2) + O( n (log log n)^2/ (log n)^2). [Cipolla, see also Cesàro or the "Prime number theorem" Wikipedia article for more terms in the expansion]
a(n) = 2 + Sum_{k = 2..floor(2n*log(n)+2)} (1floor(pi(k)/n)), for n > 1, where the formula for pi(k) is given in A000720 (Ruiz and Sondow 2002).  Jonathan Sondow, Mar 06 2004
I conjecture that Sum_{i>=1} (1/(prime(i)*log(prime(i)))) = Pi/2 = 1.570796327...; Sum_{i=1..100000} (1/(prime(i)*log(prime(i)))) = 1.565585514... It converges very slowly.  Miklos Kristof, Feb 12 2007
The last conjecture has been discussed by the math.research newsgroup recently. The sum, which is greater than Pi/2, is shown in sequence A137245.  T. D. Noe, Jan 13 2009
Conjecture:
a(n) = {n n! mod n^2 = n(n1)}, n <> 4.
a(n) = {n n!*h(n) mod n = n1}, n <> 4, where h(n) = Sum_{k=1..n} 1/k. (End)
For n = 1..15, a(n) = p + abs(p3/2) + 1/2, where p = m + int((m3)/2), and m = n + int((n2)/8) + int((n4)/8).  Timothy Hopper, Oct 23 2010
Conjecture: Sequence = {5 and n <> 5 ( Fibonacci(n) mod n = 1 or Fibonacci(n) mod n = n  1) and 2^(n1) mod n = 1}.  Gary Detlefs, May 25 2014
Conjecture: Sequence = {5 and n <> 5 ( Fibonacci(n) mod n = 1 or Fibonacci(n) mod n = n  1) and 2^(3*n) mod 3*n = 8}.  Gary Detlefs, May 28 2014
a(n) = 1 + Sum_{m=1..L(n)} (abs(nPi(m))abs(nPi(m)1/2)+1/2), where Pi(m) = A000720(m) and L(n) >= a(n)1. L(n) can be any function of n which satisfies the inequality. For instance, L(n) can be ceiling((n+1)*log((n+1)*log(n+1))) since it satisfies this inequality.  Timothy Hopper, May 30 2015, Jun 16 2015
Satisfies a(n) = 2*n + Sum_{k=1..(a(n)1)} cot(k*Pi/a(n))*sin(2*k*n^a(n)*Pi/a(n)).  Ilya Gutkovskiy, Jun 29 2016
Sum_{n>=1} 1/a(n)^s = P(s), where P(s) is the prime zeta function.  Eric W. Weisstein, Nov 08 2016
a(n) = floor(1  log(1/2 + Sum_{ d  A002110(n1) } mu(d)/(2^d1))/log(2)) where mu(d) = A008683(d). Golomb gave a proof in 1974: Give each positive integer a probability of W(n) = 1/2^n, then the probability M(d) of the integer multiple of number d equals 1/(2^d1). Suppose Q = a(1)*a(2)*...*a(n1) = A002110(n1), then the probability of random integers that are mutually prime with Q is Sum_{ d  Q } mu(d)*M(d) = Sum_{ d  Q } mu(d)/(2^d1) = Sum_{ gcd(m, Q) = 1 } W(m) = 1/2 + 1/2^a(n) + 1/2^a(n+1) + 1/2^a(n+2) + ... So ((Sum_{ d  Q } mu(d)/(2^d1))  1/2)*2^a(n) = 1 + x(n), which means that a(n) is the only integer so that 1 < ((Sum_{ d  Q } mu(d)/(2^d1))  1/2)*2^a(n) < 2.  Jinyuan Wang, Apr 08 2019


MAPLE

A000040 := n>ithprime(n); [ seq(ithprime(i), i=1..100) ];
# For illustration purposes only:
isPrime := s > is(1 = sin(Pi*GAMMA(s)/s)/sin(Pi/s)):


MATHEMATICA

Prime[Range[60]]


PROG

(Magma) [n : n in [2..500]  IsPrime(n)];
(Magma) a := func< n  NthPrime(n) >;
(PARI) {a(n) = if( n<1, 0, prime(n))};
(PARI) /* The following functions provide asymptotic approximations, one based on the asymptotic formula cited above (slight overestimate for n > 10^8), the other one based on pi(x) ~ li(x) = Ei(log(x)) (slight underestimate): */
prime1(n)=n*(log(n)+log(log(n))1+(log(log(n))2)/log(n)((log(log(n))6)*log(log(n))+11)/log(n)^2/2)
prime2(n)=solve(X=n*log(n)/2, 2*n*log(n), real(eint1(log(X)))+n)
(PARI) forprime(p=2, 10^3, print1(p, ", ")) \\ Felix Fröhlich, Jun 30 2014
if n = 1 then return(2),
)$ /* recursive, to be replaced if possible  R. J. Mathar, Feb 27 2012 */
(Haskell) See also Haskell Wiki Link
import Data.List (genericIndex)
a000040 n = genericIndex a000040_list (n  1)
a000040_list = base ++ larger where
base = [2, 3, 5, 7, 11, 13, 17]
larger = p : filter prime more
prime n = all ((> 0) . mod n) $ takeWhile (\x > x*x <= n) larger
_ : p : more = roll $ makeWheels base
roll (Wheel n rs) = [n * k + r  k < [0..], r < rs]
makeWheels = foldl nextSize (Wheel 1 [1])
nextSize (Wheel size bs) p = Wheel (size * p)
[r  k < [0..p1], b < bs, let r = size*k+b, mod r p > 0]
data Wheel = Wheel Integer [Integer]
(GAP)
(Python)
from sympy import primerange


CROSSREFS

Cf. A003558, A179480 (relating to the Quasiorder theorem of Hilton and Pedersen).


KEYWORD

core,nonn,nice,easy


AUTHOR



STATUS

approved



