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

A045915 Erroneous version of A057835.

Original entry on oeis.org

4, 24, 144, 908, 6117, 44159, 332775, 2592589, 20758019, 169922924, 1416703346, 11992874160, 10283824252
Offset: 2

Views

Author

Keywords

References

  • C. Clawson, Mathematical Mysteries, Plenum Press, 1996, p. 157

Formula

a(n) = pi(n) - n/log(n).

A128910 Similar to A057835 except using K * X / log(X), K=1.022.

Original entry on oeis.org

0, 3, 20, 119, 715, 4523, 30509, 213343, 1530983, 11203550, 83064263, 620498643, 4643259527, 34592032908, 254639722327, 1832740718223, 12680919388801, 81678704122892, 452951221016511, 1574800035301944, 8395299939524712, 282240813012897282, 4457697545906326118, 58106920364272792945, 693274802905577732102, 7864635685729658131835
Offset: 1

Views

Author

Bill McEachen, Apr 23 2007

Keywords

Comments

This is an improvement over the classic X / log(X) approximation in the range many people work with.
pi(x), R(x), and li(x) are all asymptotically x/log x + x/log^2 x + O(x/log^3 x), so this approximation is good around exp(1/.022) ≈ 5 * 10^19. Asymptotically the best value for K would be 1. - Charles R Greathouse IV, Aug 18 2022

Examples

			a(10)=11203550 via abs (455,052,511 - 443,848,961).
		

Crossrefs

Programs

  • Mathematica
    Table[ PrimePi[10^n] - Round[N[1.022*10^n/Log[10^n]]], {n, 23}] (* and absolute value thereof (orig entries 21-23 <0); courtesy of Robert G. Wilson v *)
  • PARI
    a(n) = abs(round(1.022*10^n/log(10^n)) - primepi(10^n)) \\ Charles R Greathouse IV, Mar 22 2015

Formula

a(n) = abs(round(1.022*10^n/log(10^n)) - pi(10^n)). - Charles R Greathouse IV, Mar 22 2015
a(n) ~ 10^n/kn with k = 104.6629.... - Charles R Greathouse IV, Mar 22 2015

A058290 Rounded difference between 10^n/(log(10^n) - A) and pi(10^n), where A is Legendre's constant and pi is the prime counting function.

Original entry on oeis.org

-1, 4, 3, 4, 2, -4, 45, 561, 6549, 69985, 690493, 6545056, 60615397, 555560046, 5070271362, 46223804313, 421692578206, 3853431791690, 35289854434775, 323979090116197, 2981921009910364, 27516571651291205, 254562416350667928
Offset: 0

Views

Author

Robert G. Wilson v, Dec 07 2000

Keywords

Comments

Legendre's constant is 1.08366 (A228211). - Alonso del Arte, Nov 02 2013
This sequence has historical rather than mathematical interest, cf. A228211. It is better to use 1 + 1/log(10^n) instead of A. Since A is given to only 5 decimal places, it does not make much sense to compute terms of this sequence beyond n ~ 10. For n = 9, the error a(9)/A006880(9) is about 0.14%, while the error for 1 + 1/log(10^9) instead of A is only about 0.04%. - M. F. Hasler, Dec 03 2018

References

  • Jan Gullberg, "Mathematics, From the Birth of Numbers", W. W. Norton and Company, NY and London, 1997, page 81.

Crossrefs

Programs

  • Mathematica
    Table[ Round[ 10^n /(Log[10^n] - 1.08366) - PrimePi[10^n] ], {n, 0, 13} ]
  • PARI
    {A006880_vec = [0, 4, 25, 168, 1229, 9592, 78498, 664579, 5761455, 50847534, 455052511 4118054813, 37607912018, 346065536839, 3204941750802, 29844570422669, 279238341033925, 2623557157654233, 24739954287740860, 234057667276344607, 2220819602560918840, 21127269486018731928, 201467286689315906290, 1925320391606803968923]} \\ Edited by M. F. Hasler, Dec 03 2018
    {default(realprecision, 100); t=log(10); for (n=0, 23, write("b058290.txt", n, " ", round(10^n/(n*t - 1.08366)) - A006880_vec[n+1]))} \\ Harry J. Smith, Jun 22 2009
    
  • PARI
    A058290(n)={10^n\/(n*log(10)-1.08366)-A006880(n)} \\ with A006880(n)=primepi(10^n) and/or precomputed values for n > 10. - M. F. Hasler, Dec 03 2018

Formula

a(n) = round(10^n/(log(10^n) - 1.08366)) - A006880(n). - M. F. Hasler, Dec 03 2018

Extensions

More terms from Harry J. Smith, Jun 22 2009

A330823 a(1) = 1; for n > 1, a(n) = a(n-1) - n if n is prime, otherwise a(n) = a(n-1) + floor(n/(log(n)-1)).

Original entry on oeis.org

1, -1, -4, 6, 1, 8, 1, 8, 15, 22, 11, 19, 6, 14, 22, 31, 14, 23, 4, 14, 24, 34, 11, 22, 33, 44, 55, 67, 38, 50, 19, 31, 44, 57, 70, 83, 46, 60, 74, 88, 47, 62, 19, 34, 50, 66, 19, 35, 51, 68, 85, 102, 49, 67, 85, 103, 121, 139, 80, 99, 38, 57, 77, 97, 117, 137, 70
Offset: 1

Views

Author

Scott R. Shannon, Jan 02 2020

Keywords

Comments

The Prime Number Theorem shows that the probability of a random number not greater than x being prime is approximately 1/log(x), therefore the probability of a number being composite in the same range is approximately (log(x)-1)/log(x). As this sequence subtracts n from the previous term if n is prime, or adds n with a weighting of 1/(log(n)-1) if n is composite, its expected value as n goes to infinity is approximately n*(1/(log(n)-1))*((log(n)-1)/log(n)) - n*(1/log(n)) = 0. We therefore expect that a(n)/n approaches 0 as n goes to infinity.
In the first 2 million terms the sequence changes sign 1900 times, has a maximum positive value of 160213275 at a(1772200), and a maximum negative value of -29535301 at a(1513751). The majority of terms are positive. See the image link below.

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = a[n - 1] + If[PrimeQ[n], -n, Floor[n/(Log[n] - 1)]]; Array[a, 67] (* Amiram Eldar, Jan 05 2020 *)

A380198 Difference between pi(2^n) and the integer nearest to 2^n / log(2^n).

Original entry on oeis.org

-2, -1, 0, 0, 2, 3, 5, 8, 15, 24, 40, 72, 119, 212, 360, 633, 1128, 1989, 3580, 6386, 11537, 20897, 37980, 69354, 127336, 234054, 431877, 799754, 1484440, 2763961, 5156791, 9644970, 18080775, 33959344, 63902732, 120474951, 227515953, 430345298, 815241632
Offset: 1

Views

Author

James C. McMahon, Jan 16 2025

Keywords

Examples

			n   2^n   pi(2^n)  round(2^n/log(2^n))  a(n)
------------------------------------------------
1     2     1         3                  -2
2     4     2         3                  -1
3     8     4         4                   0
4    16     6         6                   0
		

Crossrefs

Programs

  • Mathematica
    Table[PrimePi[2^n]-Round[2^n/Log[2^n]],{n,39}]

Formula

a(n) = - A053622(2^n).
a(n) = A007053(n) - A050499(2^n).

A209883 Decimal expansion of constant C = maximum value that PrimePi(n)*log(n)/n reaches where PrimePi(n) is the number of primes less than or equal to n, A000720.

Original entry on oeis.org

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

Views

Author

Frank M Jackson, Mar 14 2012

Keywords

Comments

The prime number theorem states that PrimePi(n) ~ n/log(n). Consequently, the function PrimePi(n)*log(n)/n tends to 1 as n tends to infinity, however it has a maximum value of 1.2550587.... when n=113. In precise terms this constant is 30*log(113)/113 and it provides an upper bound for PrimePi(n), i.e. PrimePi(n) <= (30*log(113)/113)*n/log(n) for all n>1.

Examples

			The maximum value for PrimePi(n)*log(n)/n occurs at n = 113.
		

Crossrefs

Programs

  • Mathematica
    $MaxPiecewiseCases=10000; sol=Maximize[{PrimePi[n]Log[n]/n, 1
    				

Formula

C = 30*log(113)/113 = 1.255058712932479796968707476181244691689202758...
Showing 1-6 of 6 results.