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

A087724 a(n) = -PrimePi(n) +floor( prime(n)/log(n))-2.

Original entry on oeis.org

1, 0, 1, 1, 2, 2, 3, 4, 6, 5, 7, 7, 8, 9, 11, 11, 12, 12, 13, 13, 15, 15, 17, 19, 19, 20, 21, 20, 21, 23, 24, 26, 26, 28, 29, 29, 30, 31, 32, 33, 33, 34, 35, 35, 35, 37, 40, 41, 41, 42, 43, 42, 44, 46, 47, 48, 48, 48, 49, 48, 50, 54, 54, 54, 55, 57, 58, 60, 61, 60, 61, 62, 63, 64
Offset: 2

Views

Author

Roger L. Bagula, Sep 29 2003

Keywords

Programs

  • Maple
    A087724 := proc(n)
        floor( ithprime(n)/log(n))-numtheory[pi](n) -2 ;
    end proc: # R. J. Mathar, May 15 2013
  • Mathematica
    Digits=200 a[n_]=-PrimePi[n]+Floor[Prime[n]/Log[n]]-2 b=Table[a[n], {n, 2, Digits}]

Formula

a(n) = A085581(n)-A000720(n) -2. - R. J. Mathar, May 15 2013

A250621 a(n) = floor(n*log(prime(n))).

Original entry on oeis.org

0, 2, 4, 7, 11, 15, 19, 23, 28, 33, 37, 43, 48, 52, 57, 63, 69, 73, 79, 85, 90, 96, 101, 107, 114, 119, 125, 130, 136, 141, 150, 156, 162, 167, 175, 180, 187, 193, 199, 206, 212, 218, 225, 231, 237, 243, 251, 259, 265, 271, 278, 284, 290, 298, 305, 312, 318, 324, 331
Offset: 1

Views

Author

Freimut Marschner, Nov 26 2014

Keywords

Comments

From n < prime(n), n >= 1 follows that n*log(n) < prime(n) < n*log(prime(n)), n >= 4. This inequality is included in the prime number theorem PNT.

Examples

			For n = 1, prime(1) = 2, floor(1*0.69... = 0.69...) = 0 ;
For n = 25, prime(25) = 97, floor(25*4.57... = 114.36...) = 114.
		

Crossrefs

Cf. A050504 (floor(n*log(n))), A086861 (floor(prime(n)/log(prime(n)))), A085581 (floor(prime(n)/log(n))), A050504 (integer part of n*log(n)), A050503 (nearest integer to n*log(n)), A050502 (ceiling of n*log(n)).

Programs

  • Mathematica
    Table[Floor[n Log[Prime[n]]],{n,60}] (* Harvey P. Dale, Aug 13 2019 *)
  • PARI
    vector(100,n,floor(n*log(prime(n)))) \\ Derek Orr, Nov 28 2014

A251482 a(n) = floor(prime(n)/log(n)) + ceiling(prime(n)/log(prime(n))) - 2*n, n >=2.

Original entry on oeis.org

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

Views

Author

Freimut Marschner, Dec 07 2014

Keywords

Comments

The prime number theorem implies prime(n)/log(prime(n)) < n < prime(n)/log(n), n >= 2. From this follows a(n).

Examples

			a(4) = floor(5.04...) + ceiling(3.59...) - 2*4 = 5 + 4 - 2*4 = 1.
		

Crossrefs

Cf. A086861 (floor(prime(n)/log(prime(n)))), A085581 (floor(prime(n)/log(n))).
Cf. A087724 (-PrimePi(n) + floor(prime(n)/log(n)) - 2), A000720 (pi(n)).
Cf. A060715 (Number of primes between n and 2n exclusive).

Programs

  • Magma
    [Floor(NthPrime(n)/Log(n)) + Ceiling(NthPrime(n)/Log(NthPrime(n))) - 2*n: n in [2..100]]; // Vincenzo Librandi, Mar 25 2015
  • Mathematica
    a251482[n_Integer] :=
    Floor[Prime[#]/Log[#]] + Ceiling[Prime[#]/Log[Prime[#]]] - 2 # & /@
    Range[2, n]; a251482[100] (* Michael De Vlieger, Dec 15 2014 *)
  • PARI
    vector(100,n,floor(prime(n+1)/log(n+1))+ceil(prime(n+1)/log(prime(n+1)))-2*n-2) \\ Derek Orr, Dec 30 2014
    

Formula

a(n) = A085581(n) + (A086861(n) + 1) - 2*n.

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 *)
Showing 1-4 of 4 results.