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-10 of 54 results. Next

A156780 sp(n)*pi(n) = A034387(n)*A000720(n) = (sum of primes <= n)*(number of primes <= n).

Original entry on oeis.org

0, 0, 2, 10, 10, 30, 30, 68, 68, 68, 68, 140, 140, 246, 246, 246, 246, 406, 406, 616, 616, 616, 616, 900, 900, 900, 900, 900, 900, 1290, 1290, 1760, 1760, 1760, 1760, 1760, 1760, 2364, 2364, 2364, 2364, 3094, 3094, 3934, 3934, 3934, 3934, 4920, 4920, 4920
Offset: 0

Views

Author

M. F. Hasler, Feb 21 2009

Keywords

Comments

All terms are even, since the parity of sp(n)=A034387(n) is always the opposite of pi(n)=A000720(n). Indeed, both change by an odd amount at each prime, starting with the first nonzero values sp(2)=2 and pi(2)=1. Thus one might also consider the integer sequence a(n)/2 = 0, 0, 1, 5, 5, 15, 15, 34, 34, 34, 34, 70, 70, 123, 123, 123, 123, 203, 203, 308,.... Sequence A156778 lists these values (without duplicates).

Programs

  • PARI
    vector(80,n,sum(i=1,primepi(n),prime(i))*primepi(n))

Formula

a(n) = 2*A156778( pi(n)), where pi(n) = A000720(n)= PrimePi(n) = #{primes <= n}.

A344581 Numbers k such that A034387(k) and A101203(k) are both prime.

Original entry on oeis.org

4, 7, 8, 15, 44, 311, 503, 507, 744, 843, 851, 955, 1164, 1256, 1287, 1307, 1312, 2163, 2171, 2244, 2247, 2368, 2412, 3143, 3160, 3872, 3875, 3952, 4584, 5088, 5236, 5355, 5364, 5380, 6211, 6303, 6307, 6587, 7243, 7244, 7436, 7439, 7860, 8220, 8268, 9167, 9283, 9515, 9519, 9632, 9692, 9915, 9919
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, May 24 2021

Keywords

Comments

Numbers k such that the sums of primes <= k and of nonprimes <= k are both prime (not necessarily distinct).
All terms == 0 or 3 (mod 4).

Examples

			a(3) = 8 is a term because A034387(8) = 2+3+5+7 = 17 and A101203(8) = 1+4+6+8 = 19 are prime.
		

Crossrefs

Cf. A034387, A101203. Intersection of A228102 and A344580.

Programs

  • Maple
    sp:= proc(n) option remember; if isprime(n) then procname(n-1)+[0,n] else procname(n-1)+[n,0] fi end proc:
    sp(1):= [1,0]:
    filter:= proc(n) andmap(isprime, sp(n)) end proc:
    select(filter, [$1..10000]);

A156779 a(n) = Sum_{d|n} sp(d), where sp(d) = A034387(d) = sum of primes <= d.

Original entry on oeis.org

0, 2, 5, 7, 10, 17, 17, 24, 22, 29, 28, 50, 41, 60, 56, 65, 58, 92, 77, 111, 99, 107, 100, 167, 110, 143, 122, 165, 129, 214, 160, 225, 193, 220, 187, 285, 197, 276, 243, 325, 238, 390, 281, 393, 354, 383, 328, 536, 345, 457, 391, 476, 381, 573, 419, 563, 463
Offset: 1

Views

Author

M. F. Hasler, Feb 21 2009

Keywords

Crossrefs

Cf. A034387.

Programs

  • Mathematica
    With[{max = 60}, sp = Accumulate[Array[# * Boole@PrimeQ[#]&, max]]; a[n_] := DivisorSum[n, sp[[#]] &]; Array[a, max]] (* Amiram Eldar, Aug 22 2023 *)
  • PARI
    vector(80,n,sumdiv(n,d,sum(i=1,primepi(d),prime(i))))

A212394 Decimal expansion of constant C = maximum value that sigma(n)*log(n^2)/n^2 reaches where sigma(n) = (sum of primes <= n), A034387.

Original entry on oeis.org

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

Views

Author

Frank M Jackson, May 14 2012

Keywords

Comments

From the prime number theorem it can be shown that the Prime sums function sigma(n) = (sum of primes <= n) ~ n^2/log(n^2). Consequently, the function sigma(n)*log(n^2)/n^2 tends to 1 as n tends to infinity, however it has a maximum value of 1.3502233687.... when n=7. In precise terms this constant is 34*log(7)/49 and it provides an upper bound for sigma(n), i.e. sigma(n) <= (34*log(7)/49)*n^2/log(n^2) for all n > 1.

Examples

			1.350223368732258211705754964838124710360426138...
		

Crossrefs

Cf. A034387.

Programs

  • Mathematica
    table=Table[Sum[Prime[k], {k, 1, PrimePi[n]}]/(n^2/(2 Log[n])), {n, 2, 10^4}]; max=Max[table]; n=1; While[table[[n]]!=max, n++]; Print[N[max, 100], " at n = ", n+1]
  • PARI
    log(7)*34/49 \\ Charles R Greathouse IV, May 14 2012

Formula

The maximum value for sigma(n)*log(n^2)/n^2 occurs at n = 7, so C = 34*log(7)/49.

A000720 pi(n), the number of primes <= n. Sometimes called PrimePi(n) to distinguish it from the number 3.14159...

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Partial sums of A010051 (characteristic function of primes). - Jeremy Gardiner, Aug 13 2002
pi(n) and prime(n) are inverse functions: a(A000040(n)) = n and A000040(n) is the least number m such that A000040(a(m)) = A000040(n). A000040(a(n)) = n if (and only if) n is prime. - Jonathan Sondow, Dec 27 2004
See the additional references and links mentioned in A143227. - Jonathan Sondow, Aug 03 2008
A lower bound that gets better with larger N is that there are at least T prime numbers less than N, where the recursive function T is: T = N - N*Sum_{i=0..T(sqrt(N))} A005867(i)/A002110(i). - Ben Paul Thurston, Aug 23 2010
Number of partitions of 2n into exactly two parts with the smallest part prime. - Wesley Ivan Hurt, Jul 20 2013
Equivalent to the Riemann hypothesis: abs(a(n) - li(n)) < sqrt(n)*log(n)/(8*Pi), for n >= 2657, where li(n) is the logarithmic integral (Lowell Schoenfeld). - Ilya Gutkovskiy, Jul 05 2016
The second Hardy-Littlewood conjecture, that pi(x) + pi(y) >= pi(x + y) for integers x and y with min{x, y} >= 2, is known to hold for (x, y) sufficiently large (Udrescu 1975). - Peter Luschny, Jan 12 2021

Examples

			There are 3 primes <= 6, namely 2, 3 and 5, so pi(6) = 3.
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, p. 8.
  • Raymond Ayoub, An Introduction to the Analytic Theory of Numbers, Amer. Math. Soc., 1963; p. 129.
  • Florian Cajori, A History of Mathematical Notations, Dover edition (2012), par. 409.
  • Richard Crandall and Carl Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 5.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, Theorems 6, 7, 420.
  • G. J. O. Jameson, The Prime Number Theorem, Camb. Univ. Press, 2003. [See also the review by D. M. Bressoud (link below).]
  • Władysław Narkiewicz, The Development of Prime Number Theory, Springer-Verlag, 2000.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 132-133, 157-184.
  • József Sándor, Dragoslav S. Mitrinovic and Borislav Crstici, Handbook of Number Theory I, Springer Science & Business Media, 2005, Section VII.1. (For inequalities, etc.).
  • 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).
  • Gerald Tenenbaum and Michel Mendès France, Prime Numbers and Their Distribution, AMS Providence RI, 1999.
  • V. Udrescu, Some remarks concerning the conjecture pi(x + y) <= pi(x) + pi(y), Rev. Roumaine Math. Pures Appl. 20 (1975), 1201-1208.

Crossrefs

Closely related:
A099802: Number of primes <= 2n.
A060715: Number of primes between n and 2n (exclusive).
A035250: Number of primes between n and 2n (inclusive).
A038107: Number of primes < n^2.
A014085: Number of primes between n^2 and (n+1)^2.
A007053: Number of primes <= 2^n.
A036378: Number of primes p between powers of 2, 2^n < p <= 2^(n+1).
A006880: Number of primes < 10^n.
A006879: Number of primes with n digits.
A033270: Number of odd primes <= n.
A065855: Number of composites <= n.
For lists of large values of a(n) see, e.g., A005669(n) = a(A002386(n)), A214935(n) = a(A205827(n)).
Related sequences:
Primes (p) and composites (c): A000040, A002808, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Haskell
    a000720 n = a000720_list !! (n-1)
    a000720_list = scanl1 (+) a010051_list  -- Reinhard Zumkeller, Sep 15 2011
    
  • Magma
    [ #PrimesUpTo(n): n in [1..200] ];  // Bruno Berselli, Jul 06 2011
    
  • Maple
    with(numtheory); A000720 := pi; [ seq(A000720(i),i=1..50) ];
  • Mathematica
    A000720[n_] := PrimePi[n]; Table[ A000720[n], {n, 1, 100} ]
    Array[ PrimePi[ # ]&, 100 ]
    Accumulate[Table[Boole[PrimeQ[n]],{n,100}]] (* Harvey P. Dale, Jan 17 2015 *)
  • PARI
    A000720=vector(100,n,omega(n!)) \\ For illustration only; better use A000720=primepi
    
  • PARI
    vector(300,j,primepi(j)) \\ Joerg Arndt, May 09 2008
    
  • Python
    from sympy import primepi
    for n in range(1,100): print(primepi(n), end=', ') # Stefano Spezia, Nov 30 2018
  • Sage
    [prime_pi(n) for n in range(1, 79)]  # Zerinvary Lajos, Jun 06 2009
    

Formula

The prime number theorem gives the asymptotic expression a(n) ~ n/log(n).
For x > 1, pi(x) < (x / log x) * (1 + 3/(2 log x)). For x >= 59, pi(x) > (x / log x) * (1 + 1/(2 log x)). [Rosser and Schoenfeld]
For x >= 355991, pi(x) < (x / log(x)) * (1 + 1/log(x) + 2.51/(log(x))^2 ). For x >= 599, pi(x) > (x / log(x)) * (1 + 1/log(x)). [Dusart]
For x >= 55, x/(log(x) + 2) < pi(x) < x/(log(x) - 4). [Rosser]
For n > 1, A138194(n) <= a(n) <= A138195(n) (Tschebyscheff, 1850). - Reinhard Zumkeller, Mar 04 2008
For n >= 33, a(n) = 1 + Sum_{j=3..n} ((j-2)! - j*floor((j-2)!/j)) (Hardy and Wright); for n >= 1, a(n) = n - 1 + Sum_{j=2..n} (floor((2 - Sum_{i=1..j} (floor(j/i)-floor((j-1)/i)))/j)) (Ruiz and Sondow 2000). - Benoit Cloitre, Aug 31 2003
a(n) = A001221(A000142(n)). - Benoit Cloitre, Jun 03 2005
G.f.: Sum_{p prime} x^p/(1-x) = b(x)/(1-x), where b(x) is the g.f. for A010051. - Franklin T. Adams-Watters, Jun 15 2006
a(n) = A036234(n) - 1. - Jaroslav Krizek, Mar 23 2009
From Enrique Pérez Herrero, Jul 12 2010: (Start)
a(n) = Sum_{i=2..n} floor((i+1)/A000203(i)).
a(n) = Sum_{i=2..n} floor(A000010(n)/(i-1)).
a(n) = Sum_{i=2..n} floor(2/A000005(n)). (End)
Let pf(n) denote the set of prime factors of an integer n. Then a(n) = card(pf(n!/floor(n/2)!)). - Peter Luschny, Mar 13 2011
a(n) = -Sum_{p <= n} mu(p). - Wesley Ivan Hurt, Jan 04 2013
a(n) = (1/2)*Sum_{p <= n} (mu(p)*d(p)*sigma(p)*phi(p)) + sum_{p <= n} p^2. - Wesley Ivan Hurt, Jan 04 2013
a(1) = 0 and then, for all k >= 1, repeat k A001223(k) times. - Jean-Christophe Hervé, Oct 29 2013
a(n) = n/(log(n) - 1 - Sum_{k=1..m} A233824(k)/log(n)^k + O(1/log(n)^{m+1})) for m > 0. - Jonathan Sondow, Dec 19 2013
a(n) = A001221(A003418(n)). - Eric Desbiaux, May 01 2014
a(n) = Sum_{j=2..n} H(-sin^2 (Pi*(Gamma(j)+1)/j)) where H(x) is the Heaviside step function, taking H(0)=1. - Keshav Raghavan, Jun 18 2016
a(A014076(n)) = (1/2) * (A014076(n) + 1) - n + 1. - Christopher Heiling, Mar 03 2017
From Steven Foster Clark, Sep 25 2018: (Start)
a(n) = Sum_{m=1..n} A143519(m) * floor(n/m).
a(n) = Sum_{m=1..n} A001221(m) * A002321(floor(n/m)) where A002321() is the Mertens function.
a(n) = Sum_{m=1..n} |A143519(m)| * A002819(floor(n/m)) where A002819() is the Liouville Lambda summatory function and |x| is the absolute value of x.
a(n) = Sum_{m=1..n} A137851(m)/m * H(floor(n/m)) where H(n) = Sum_{m=1..n} 1/m is the harmonic number function.
a(n) = Sum_{m=1..log_2(n)} A008683(m) * A025528(floor(n^(1/m))) where A008683() is the Moebius mu function and A025528() is the prime-power counting function.
(End)
Sum_{k=2..n} 1/a(k) ~ (1/2) * log(n)^2 + O(log(n)) (de Koninck and Ivić, 1980). - Amiram Eldar, Mar 08 2021
a(n) ~ 1/(n^(1/n)-1). - Thomas Ordowski, Jan 30 2023
a(n) = Sum_{j=2..n} floor(((j - 1)! + 1)/j - floor((j - 1)!/j)) [Mináč, unpublished] (see Ribenboim, pp. 132-133). - Stefano Spezia, Apr 13 2025
a(n) = n - 1 - Sum_{k=2..floor(log_2(n))} pi_k(n), where pi_k(n) is the number of k-almost primes <= n. - Daniel Suteu, Aug 27 2025

Extensions

Additional links contributed by Lekraj Beedassy, Dec 23 2003
Edited by M. F. Hasler, Apr 27 2018 and (links recovered) Dec 21 2018

A002110 Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#.

Original entry on oeis.org

1, 2, 6, 30, 210, 2310, 30030, 510510, 9699690, 223092870, 6469693230, 200560490130, 7420738134810, 304250263527210, 13082761331670030, 614889782588491410, 32589158477190044730, 1922760350154212639070, 117288381359406970983270, 7858321551080267055879090
Offset: 0

Views

Author

Keywords

Comments

See A034386 for the second definition of primorial numbers: product of primes in the range 2 to n.
a(n) is the least number N with n distinct prime factors (i.e., omega(N) = n, cf. A001221). - Lekraj Beedassy, Feb 15 2002
Phi(n)/n is a new minimum for each primorial. - Robert G. Wilson v, Jan 10 2004
Smallest number stroked off n times after the n-th sifting process in an Eratosthenes sieve. - Lekraj Beedassy, Mar 31 2005
Apparently each term is a new minimum for phi(x)*sigma(x)/x^2. 6/Pi^2 < sigma(x)*phi(x)/x^2 < 1 for n > 1. - Jud McCranie, Jun 11 2005
Let f be a multiplicative function with f(p) > f(p^k) > 1 (p prime, k > 1), f(p) > f(q) > 1 (p, q prime, p < q). Then the record maxima of f occur at n# for n >= 1. Similarly, if 0 < f(p) < f(p^k) < 1 (p prime, k > 1), 0 < f(p) < f(q) < 1 (p, q prime, p < q), then the record minima of f occur at n# for n >= 1. - David W. Wilson, Oct 23 2006
Wolfe and Hirshberg give ?, ?, ?, ?, ?, 30030, ?, ... as a puzzle.
Records in number of distinct prime divisors. - Artur Jasinski, Apr 06 2008
For n >= 2, the digital roots of a(n) are multiples of 3. - Parthasarathy Nambi, Aug 19 2009 [with corrections by Zak Seidov, Aug 30 2015]
Denominators of the sum of the ratios of consecutive primes (see A094661). - Vladimir Joseph Stephan Orlovsky, Oct 24 2009
Where record values occur in A001221. - Melinda Trang (mewithlinda(AT)yahoo.com), Apr 15 2010
It can be proved that there are at least T prime numbers less than N, where the recursive function T is: T = N - N*Sum_{i = 0..T(sqrt(N))} A005867(i)/A002110(i). This can show for example that at least 0.16*N numbers are primes less than N for 29^2 > N > 23^2. - Ben Paul Thurston, Aug 23 2010
The above comment from Parthasarathy Nambi follows from the observation that digit summing produces a congruent number mod 9, so the digital root of any multiple of 3 is a multiple of 3. prime(n)# is divisible by 3 for n >= 2. - Christian Schulz, Oct 30 2013
The peaks (i.e., local maximums) in a graph of the number of repetitions (i.e., the tally of values) vs. value, as generated by taking the differences of all distinct pairs of odd prime numbers within a contiguous range occur at regular periodic intervals given by the primorial numbers 6 and greater. Larger primorials yield larger (relative) peaks, however the range must be >50% larger than the primorial to be easily observed. Secondary peaks occur at intervals of those "near-primorials" divisible by 6 (e.g., 42). See A259629. Also, periodicity at intervals of 6 and 30 can be observed in the local peaks of all possible sums of two, three or more distinct odd primes within modest contiguous ranges starting from p(2) = 3. - Richard R. Forberg, Jul 01 2015
If a number k and a(n) are coprime and k < (prime(n+1))^b < a(n), where b is an integer, then k has fewer than b prime factors, counting multiplicity (i.e., bigomega(k) < b, cf. A001222). - Isaac Saffold, Dec 03 2017
If n > 0, then a(n) has 2^n unitary divisors (A034444), and a(n) is a record; i.e., if k < a(n) then k has fewer unitary divisors than a(n) has. - Clark Kimberling, Jun 26 2018
Unitary superabundant numbers: numbers k with a record value of the unitary abundancy index, A034448(k)/k > A034448(m)/m for all m < k. - Amiram Eldar, Apr 20 2019
Psi(n)/n is a new maximum for each primorial (psi = A001615) [proof in link: Patrick Sole and Michel Planat, proposition 1 page 2]; compare with comment 2004: Phi(n)/n is a new minimum for each primorial. - Bernard Schott, May 21 2020
The term "primorial" was coined by Harvey Dubner (1987). - Amiram Eldar, Apr 16 2021
a(n)^(1/n) is approximately (n log n)/e. - Charles R Greathouse IV, Jan 03 2023
Subsequence of A267124. - Frank M Jackson, Apr 14 2023

Examples

			a(9) = 23# = 2*3*5*7*11*13*17*19*23 = 223092870 divides the difference 5283234035979900 in the arithmetic progression of 26 primes A204189. - _Jonathan Sondow_, Jan 15 2012
		

References

  • A. Fletcher, J. C. P. Miller, L. Rosenhead and L. J. Comrie, An Index of Mathematical Tables. Vols. 1 and 2, 2nd ed., Blackwell, Oxford and Addison-Wesley, Reading, MA, 1962, Vol. 1, p. 50.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 49.
  • P. Ribenboim, The Book of Prime Number Records. Springer-Verlag, NY, 2nd ed., 1989, p. 4.
  • 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).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 114.
  • D. Wolfe and S. Hirshberg, Underspecified puzzles, in Tribute to A Mathemagician, Peters, 2005, pp. 73-74.

Crossrefs

A034386 gives the second version of the primorial numbers.
Subsequence of A005117 and of A064807. Apart from the first term, a subsequence of A083207.
Cf. A001615, A002182, A002201, A003418, A005235, A006862, A034444 (unitary divisors), A034448, A034387, A033188, A035345, A035346, A036691 (compositorial numbers), A049345 (primorial base representation), A057588, A060735 (and integer multiples), A061742 (squares), A072938, A079266, A087315, A094348, A106037, A121572, A053589, A064648, A132120, A260188.
Cf. A061720 (first differences), A143293 (partial sums).
Cf. also A276085, A276086.
The following fractions are all related to each other: Sum 1/n: A001008/A002805, Sum 1/prime(n): A024451/A002110 and A106830/A034386, Sum 1/nonprime(n): A282511/A282512, Sum 1/composite(n): A250133/A296358.

Programs

  • Haskell
    a002110 n = product $ take n a000040_list
    a002110_list = scanl (*) 1 a000040_list
    -- Reinhard Zumkeller, Feb 19 2012, May 03 2011
    
  • Magma
    [1] cat [&*[NthPrime(i): i in [1..n]]: n in [1..20]]; // Bruno Berselli, Oct 24 2012
    
  • Magma
    [1] cat [&*PrimesUpTo(p): p in PrimesUpTo(60)]; // Bruno Berselli, Feb 08 2015
    
  • Maple
    A002110 := n -> mul(ithprime(i),i=1..n);
  • Mathematica
    FoldList[Times, 1, Prime[Range[20]]]
    primorial[n_] := Product[Prime[i], {i, n}]; Array[primorial,20] (* José María Grau Ribas, Feb 15 2010 *)
    Join[{1}, Denominator[Accumulate[1/Prime[Range[20]]]]] (* Harvey P. Dale, Apr 11 2012 *)
  • PARI
    a(n)=prod(i=1,n, prime(i)) \\ Washington Bomfim, Sep 23 2008
    
  • PARI
    p=1; for (n=0, 100, if (n, p*=prime(n)); write("b002110.txt", n, " ", p) )  \\ Harry J. Smith, Nov 13 2009
    
  • PARI
    a(n) = factorback(primes(n)) \\ David A. Corneth, May 06 2018
    
  • Python
    from sympy import primorial
    def a(n): return 1 if n < 1 else primorial(n)
    [a(n) for n in range(51)]  # Indranil Ghosh, Mar 29 2017
    
  • Sage
    [sloane.A002110(n) for n in (1..20)] # Giuseppe Coppoletta, Dec 05 2014
    
  • Scheme
    ; with memoization-macro definec
    (definec (A002110 n) (if (zero? n) 1 (* (A000040 n) (A002110 (- n 1))))) ;; Antti Karttunen, Aug 30 2016

Formula

Asymptotic expression for a(n): exp((1 + o(1)) * n * log(n)) where o(1) is the "little o" notation. - Dan Fux (dan.fux(AT)OpenGaia.com or danfux(AT)OpenGaia.com), Apr 08 2001
a(n) = A054842(A002275(n)).
Binomial transform = A136104: (1, 3, 11, 55, 375, 3731, ...). Equals binomial transform of A121572: (1, 1, 3, 17, 119, 1509, ...). - Gary W. Adamson, Dec 14 2007
a(0) = 1, a(n+1) = prime(n)*a(n). - Juri-Stepan Gerasimov, Oct 15 2010
a(n) = Product_{i=1..n} A000040(i). - Jonathan Vos Post, Jul 17 2008
a(A051838(n)) = A116536(n) * A007504(A051838(n)). - Reinhard Zumkeller, Oct 03 2011
A000005(a(n)) = 2^n. - Carlos Eduardo Olivieri, Jun 16 2015
a(n) = A035345(n) - A005235(n) for n > 0. - Jonathan Sondow, Dec 02 2015
For all n >= 0, a(n) = A276085(A000040(n+1)), a(n+1) = A276086(A143293(n)). - Antti Karttunen, Aug 30 2016
A054841(a(n)) = A002275(n). - Michael De Vlieger, Aug 31 2016
a(n) = A270592(2*n+2) - A270592(2*n+1) if 0 <= n <= 4 (conjectured for all n by Alon Kellner). - Jonathan Sondow, Mar 25 2018
Sum_{n>=1} 1/a(n) = A064648. - Amiram Eldar, Oct 16 2020
Sum_{n>=1} (-1)^(n+1)/a(n) = A132120. - Amiram Eldar, Apr 12 2021
Theta being Chebyshev's theta function, a(0) = exp(theta(1)), and for n > 0, a(n) = exp(theta(m)) for A000040(n) <= m < A000040(n+1) where m is an integer. - Miles Englezou, Nov 26 2024

A007504 Sum of the first n primes.

Original entry on oeis.org

0, 2, 5, 10, 17, 28, 41, 58, 77, 100, 129, 160, 197, 238, 281, 328, 381, 440, 501, 568, 639, 712, 791, 874, 963, 1060, 1161, 1264, 1371, 1480, 1593, 1720, 1851, 1988, 2127, 2276, 2427, 2584, 2747, 2914, 3087, 3266, 3447, 3638, 3831, 4028, 4227, 4438, 4661, 4888
Offset: 0

Views

Author

Keywords

Comments

It appears that a(n)^2 - a(n-1)^2 = A034960(n). - Gary Detlefs, Dec 20 2011
This is true. Proof: By definition we have A034960(n) = Sum_{k = (a(n-1)+1)..a(n)} (2*k-1). Since Sum_{k = 1..n} (2*k-1) = n^2, it follows A034960(n) = a(n)^2 - a(n-1)^2, for n > 1. - Hieronymus Fischer, Sep 27 2012 [formulas above adjusted to changed offset of A034960 - Hieronymus Fischer, Oct 14 2012]
Row sums of the triangle in A037126. - Reinhard Zumkeller, Oct 01 2012
Ramanujan noticed the apparent identity between the prime parts partition numbers A000607 and the expansion of Sum_{k >= 0} x^a(k)/((1-x)...(1-x^k)), cf. A046676. See A192541 for the difference between the two. - M. F. Hasler, Mar 05 2014
For n > 0: row 1 in A254858. - Reinhard Zumkeller, Feb 08 2015
a(n) is the smallest number that can be partitioned into n distinct primes. - Alonso del Arte, May 30 2017
For a(n) < m < a(n+1), n > 0, at least one m is a perfect square.
Proof: For n = 1, 2, ..., 6, the proposition is clear. For n > 6, a(n) < ((prime(n) - 1)/2)^2, set (k - 1)^2 <= a(n) < k^2 < ((prime(n) + 1)/2)^2, then k^2 < (k - 1)^2 + prime(n) <= a(n) + prime(n) = a(n+1), so m = k^2 is this perfect square. - Jinyuan Wang, Oct 04 2018
For n >= 5 we have a(n) < ((prime(n)+1)/2)^2. This can be shown by noting that ((prime(n)+1)/2)^2 - ((prime(n-1)+1)/2)^2 - prime(n) = (prime(n)+prime(n-1))*(prime(n)-prime(n-1)-2)/4 >= 0. - Jianing Song, Nov 13 2022
Washington gives an oscillation formula for |a(n) - pi(n^2)|, see links. - Charles R Greathouse IV, Dec 07 2022

References

  • E. Bach and J. Shallit, §2.7 in Algorithmic Number Theory, Vol. 1: Efficient Algorithms, MIT Press, Cambridge, MA, 1996.
  • H. L. Nelson, "Prime Sums", J. Rec. Math., 14 (1981), 205-206.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A122989 for the value of Sum_{n >= 1} 1/a(n).

Programs

  • GAP
    P:=Filtered([1..250],IsPrime);;
    a:=Concatenation([0],List([1..Length(P)],i->Sum([1..i],k->P[k]))); # Muniru A Asiru, Oct 07 2018
    
  • Haskell
    a007504 n = a007504_list !! n
    a007504_list = scanl (+) 0 a000040_list
    -- Reinhard Zumkeller, Oct 01 2014, Oct 03 2011
    
  • Magma
    [0] cat [&+[ NthPrime(k): k in [1..n]]: n in [1..50]]; // Bruno Berselli, Apr 11 2011 (adapted by Vincenzo Librandi, Nov 27 2015 after Hasler's change on Mar 05 2014)
    
  • Maple
    s1:=[2]; for n from 2 to 1000 do s1:=[op(s1),s1[n-1]+ithprime(n)]; od: s1;
    A007504 := proc(n)
        add(ithprime(i), i=1..n) ;
    end proc: # R. J. Mathar, Sep 20 2015
  • Mathematica
    Accumulate[Prime[Range[100]]] (* Zak Seidov, Apr 10 2011 *)
    primeRunSum = 0; Table[primeRunSum = primeRunSum + Prime[k], {k, 100}] (* Zak Seidov, Apr 16 2011 *)
  • PARI
    A007504(n) = sum(k=1,n,prime(k)) \\ Michael B. Porter, Feb 26 2010
    
  • PARI
    a(n) = vecsum(primes(n)); \\ Michel Marcus, Feb 06 2021
    
  • Python
    from itertools import accumulate, count, islice
    from sympy import prime
    def A007504_gen(): return accumulate(prime(n) if n > 0 else 0 for n in count(0))
    A007504_list = list(islice(A007504_gen(),20)) # Chai Wah Wu, Feb 23 2022

Formula

a(n) ~ n^2 * log(n) / 2. - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 24 2001 (see Bach & Shallit 1996)
a(n) = A014284(n+1) - 1. - Jaroslav Krizek, Aug 19 2009
a(n+1) - a(n) = A000040(n+1). - Jaroslav Krizek, Aug 19 2009
a(A051838(n)) = A002110(A051838(n)) / A116536(n). - Reinhard Zumkeller, Oct 03 2011
a(n) = min(A068873(n), A073619(n)) for n > 1. - Jonathan Sondow, Jul 10 2012
a(n) = A033286(n) - A152535(n). - Omar E. Pol, Aug 09 2012
For n >= 3, a(n) >= (n-1)^2 * (log(n-1) - 1/2)/2 and a(n) <= n*(n+1)*(log(n) + log(log(n))+ 1)/2. Thus a(n) = n^2 * log(n) / 2 + O(n^2*log(log(n))). It is more precise than in Fares's comment. - Vladimir Shevelev, Aug 01 2013
a(n) = (n^2/2)*(log n + log log n - 3/2 + (log log n - 3)/log n + (2 (log log n)^2 - 14 log log n + 27)/(4 log^2 n) + O((log log n/log n)^3)) [Sinha]. - Charles R Greathouse IV, Jun 11 2015
G.f: (x*b(x))/(1-x), where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 10 2016
a(n) = A008472(A002110(n)), for n > 0. - Michel Marcus, Jul 16 2020

Extensions

More terms from Stefan Steinerberger, Apr 11 2006
a(0) = 0 prepended by M. F. Hasler, Mar 05 2014

A034386 Primorial numbers (second definition): n# = product of primes <= n.

Original entry on oeis.org

1, 1, 2, 6, 6, 30, 30, 210, 210, 210, 210, 2310, 2310, 30030, 30030, 30030, 30030, 510510, 510510, 9699690, 9699690, 9699690, 9699690, 223092870, 223092870, 223092870, 223092870, 223092870, 223092870, 6469693230, 6469693230, 200560490130, 200560490130
Offset: 0

Views

Author

Keywords

Comments

Squarefree kernel of both n! and lcm(1, 2, 3, ..., n).
a(n) = lcm(core(1), core(2), core(3), ..., core(n)) where core(x) denotes the squarefree part of x, the smallest integer such that x*core(x) is a square. - Benoit Cloitre, May 31 2002
The sequence can also be obtained by taking a(1) = 1 and then multiplying the previous term by n if n is coprime to the previous term a(n-1) and taking a(n) = a(n-1) otherwise. - Amarnath Murthy, Oct 30 2002; corrected by Franklin T. Adams-Watters, Dec 13 2006

Examples

			a(5) = a(6) = 2*3*5 = 30;
a(7) = 2*3*5*7 = 210.
		

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 1.3, p. 14, "n?".
  • József Sándor, Dragoslav S. Mitrinovic, Borislav Crstici, Handbook of Number Theory I, Springer Science & Business Media, 2005, Section VII.35, p. 268.

Crossrefs

Cf. A073838, A034387. - Reinhard Zumkeller, Jul 05 2010
The following fractions are all related to each other: Sum 1/n: A001008/A002805, Sum 1/prime(n): A024451/A002110 and A106830/A034386, Sum 1/nonprime(n): A282511/A282512, Sum 1/composite(n): A250133/A296358.

Programs

  • Magma
    [n eq 0 select 1 else LCM(PrimesInInterval(1, n)) : n in [0..50]]; // G. C. Greubel, Jul 21 2023
  • Maple
    A034386 := n -> mul(k,k=select(isprime,[$1..n])); # Peter Luschny, Jun 19 2009
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 1,
          `if`(isprime(n), n, 1)*a(n-1))
        end:
    seq(a(n), n=0..36);  # Alois P. Heinz, Nov 26 2020
  • Mathematica
    q[x_]:=Apply[Times,Table[Prime[w],{w,1,PrimePi[x]}]]; Table[q[w],{w,1,30}]
    With[{pr=FoldList[Times,1,Prime[Range[20]]]},Table[pr[[PrimePi[n]+1]],{n,0,40}]] (* Harvey P. Dale, Apr 05 2012 *)
    Table[ResourceFunction["Primorial"][i], {i,1,40}] (* Navvye Anand, May 22 2024 *)
  • PARI
    a(n)=my(v=primes(primepi(n)));prod(i=1,#v,v[i]) \\ Charles R Greathouse IV, Jun 15 2011
    
  • PARI
    a(n)=lcm(primes([2,n])) \\ Jeppe Stig Nielsen, Mar 10 2019
    
  • Python
    from sympy import primorial
    def A034386(n): return 1 if n == 0 else primorial(n,nth=False) # Chai Wah Wu, Jan 11 2022
    
  • SageMath
    def sharp_primorial(n): return sloane.A002110(prime_pi(n))
    [sharp_primorial(n) for n in (0..30)] # Giuseppe Coppoletta, Jan 26 2015
    

Formula

a(n) = n# = A002110(A000720(n)) = A007947(A003418(n)) = A007947(A000142(n)).
Asymptotic expression for a(n): exp((1 + o(1)) * n) where o(1) is the "little o" notation. - Dan Fux (dan.fux(AT)OpenGaia.com or danfux(AT)OpenGaia.com), Apr 08 2001
For n > 0, log(a(n)) < 1.01624*n. [Rosser and Schoenfeld, 1962; Sándor et al., 2005] - N. J. A. Sloane, Apr 04 2017
a(n) <= A179215(n). - Reinhard Zumkeller, Jul 05 2010
a(n) = lcm(A006530(n), a(n-1)). - Jon Maiga, Nov 10 2018
Sum_{n>=0} 1/a(n) = A249270. - Amiram Eldar, Nov 08 2020

Extensions

Offset changed and initial term added by Arkadiusz Wesolowski, Jun 04 2011

A061397 Characteristic function sequence of primes multiplied componentwise by N, the natural numbers.

Original entry on oeis.org

0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 0, 13, 0, 0, 0, 17, 0, 19, 0, 0, 0, 23, 0, 0, 0, 0, 0, 29, 0, 31, 0, 0, 0, 0, 0, 37, 0, 0, 0, 41, 0, 43, 0, 0, 0, 47, 0, 0, 0, 0, 0, 53, 0, 0, 0, 0, 0, 59, 0, 61, 0, 0, 0, 0, 0, 67, 0, 0, 0, 71, 0, 73, 0, 0, 0, 0, 0, 79, 0, 0, 0, 83, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Labos Elemer, Jun 07 2001

Keywords

Comments

Frequently, holes in a sequence are filled with zeros. This is a canonical way to do this and applied here to primes(A000040). A pre-scalar product when summation is omitted.
Equals row sums of triangle A143536. - Gary W. Adamson, Aug 23 2008
Mobius transform of sum of the distinct primes dividing n (A008472). - Steven Foster Clark, Jun 26 2020

Examples

			If 1<n<=8, a(n)=0 iff it is even on interval [4,9); if 9<=n<=25, then a(n)=0 iff n is either even or multiple of 3 on interval [9,25) etc. - _Vladimir Shevelev_, Apr 24 2010
		

Crossrefs

Cf. A034387 (partial sums).

Programs

Formula

a(n) = A010051(n)*A000027(n).
Dirichlet generating function: primezeta(s-1). - Franklin T. Adams-Watters, Sep 11 2005
a(1)=0; for n>=1, a(n)=0, if either p_1|n or p_2|n or...or p_i|n, when n is in [p_i^2,p_(i+1)^2), i=1,2,..], where p_i is the i-th prime; otherwise a(n)=n. - Vladimir Shevelev, Apr 24 2010
a(n) = n*floor(gcd(((n-1)! + 1)/n,2)). - José de Jesús Camacho Medina, Apr 30 2016
a(n) = n*floor(1/A001065(n)); for n>1. - José de Jesús Camacho Medina, Aug 07 2016
G.f.: x*f'(x), where f(x) = Sum_{k>=1} x^prime(k). - Ilya Gutkovskiy, Apr 10 2017
a(n) = (2*n-1)! mod n^2, by Wilson's theorem. - Thomas Ordowski, Dec 27 2017

A046992 a(n) = Sum_{k=1..n} pi(k) (cf. A000720).

Original entry on oeis.org

0, 1, 3, 5, 8, 11, 15, 19, 23, 27, 32, 37, 43, 49, 55, 61, 68, 75, 83, 91, 99, 107, 116, 125, 134, 143, 152, 161, 171, 181, 192, 203, 214, 225, 236, 247, 259, 271, 283, 295, 308, 321, 335, 349, 363, 377, 392, 407, 422, 437, 452, 467, 483, 499, 515, 531, 547, 563, 580, 597, 615, 633, 651, 669
Offset: 1

Views

Author

Keywords

Comments

a(n) = A002815(n) - n. - Reinhard Zumkeller, Feb 25 2012
From Hieronymus Fischer, Sep 26 2012: (Start)
Let S(n) be a string of length n, then a(n) is the number of substrings of S(n) with a prime number of characters. Example 1: "abcd" is a string of length 4; there are a(4)=5 substrings with a prime number of characters (ab, bc, cd, abc and bcd). Example 2: "abcde" is a string of length 5; there are a(5)=8 substrings with a prime number of characters (ab, bc, cd, de, abc, bcd, cde and abcde).
Also: If n is represented in base 1 (this means 1=1_1, 2=11_1, 3=111_1, 4=1111_1, etc.), then a(n) is the number of substrings of n with a prime number of digits. Example: 7=1111111_1; the number of prime substrings of 7 (in base 1) is a(7)=15, since there are 15 substrings of prime length: 6 2-digit substrings, 5 3-digit substrings, 3 5-digit substrings and 1 7-digit substring.
(End)

Crossrefs

Programs

  • Haskell
    a046992 n = a046992_list !! (n-1)
    a046992_list = scanl1 (+) a000720_list
    -- Reinhard Zumkeller, Feb 25 2012
    
  • Mathematica
    f[n_] := (f[n - 1] + PrimePi[n]); f[1] = 0; Table[ f[n], {n, 1, 60}]
    Accumulate[PrimePi[Range[70]]] (* Harvey P. Dale, Feb 27 2013 *)
  • PARI
    a(n)=my(N=n+1,s); forprime(p=2,n, s+=N-p); s \\ Charles R Greathouse IV, Mar 03 2017
    
  • Python
    from sympy import primerange
    def A046992(n): return (n+1)*len(p:=list(primerange(n+1)))-sum(p) # Chai Wah Wu, Jan 01 2024

Formula

O.g.f.: A(x)/(1-x)^2 where A(x) = Sum_{p=prime} x^p is the o.g.f. of A010051 and A(x)/(1-x) is the o.g.f. of A000720. - Geoffrey Critzer, Dec 04 2011
From Hieronymus Fischer, Sep 26 2012: (Start)
a(n) = Sum_{p<=n, p is prime} (n - p +1).
a(n) = (n+1)*pi(n) - Sum_pi(n), where pi(n) = number of primes <= n and Sum_pi(n) = sum of primes <= n.
a(n) = (n+1)*A000720(n) - A034387(n).
(End)
a(n) ~ n^2 / (2 log n). - Charles R Greathouse IV, Mar 03 2017

Extensions

Corrected by Henry Bottomley
Showing 1-10 of 54 results. Next