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.

A055399 Number of stages of sieve of Eratosthenes needed to identify n as prime or composite.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 2, 1, 3, 1, 3, 1, 2, 1, 3, 1, 3, 1, 2, 1, 4, 1, 4, 1, 2, 1, 3, 1, 4, 1, 2, 1, 4, 1, 4, 1, 2, 1, 4, 1, 4, 1, 2, 1, 5, 1, 3, 1, 2, 1, 5, 1, 5, 1, 2, 1, 3, 1, 5, 1, 2, 1, 5, 1, 5, 1, 2, 1, 4, 1, 5, 1, 2, 1, 5, 1, 3, 1, 2, 1, 5
Offset: 3

Views

Author

Henry Bottomley, May 15 2000

Keywords

Comments

Primes are known as primes actually one step before a(n): at step k of the sieve, multiples of prime(k) are removed, the smallest integer removed being prime(k)^2; every remaining integer less than prime(k+1)^2 will then never be removed, and it is newly known at step k for those between prime(k)^2 and prime(k+1)^2. For example, at step 3, multiples of prime(3) = 5 are removed and remaining integers after this step are prime up to prime(4)^2 = 49; then, 29, 31, 37, 41, 43, 47 are known as prime at step 3. - Jean-Christophe Hervé, Nov 01 2013

Examples

			a(7)=2 because 7 is not removed by the first two stages of the sieve, but is less than the square of the second prime (though not the square of the first); a(35)=3 because 35 is removed in the third stage as a multiple of 5.
		

Crossrefs

Programs

  • Mathematica
    a[n_ /; !PrimeQ[n]] := PrimePi[ FactorInteger[n][[1, 1]]]; a[n_ /; PrimeQ[n]] := PrimePi[ NextPrime[ Sqrt[n]]]; Table[a[n], {n, 3, 107}](* Jean-François Alcover, Jun 11 2012, after formula *)

Formula

If n is composite, a(n) = A055396(n); if n is prime, a(n) = A056811(n)+1. [Corrected by Charles R Greathouse IV, Sep 03 2013]
a(n) = A010051(n)*(A056811(n)+1)+(1-A010051(n))*A055396(n). - Jean-Christophe Hervé, Nov 01 2013

A054403 Result of third stage of sieve of Eratosthenes (after eliminating multiples of 2, 3 and 5).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89, 91, 97, 101, 103, 107, 109, 113, 119, 121, 127, 131, 133, 137, 139, 143, 149, 151, 157, 161, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 203, 209, 211
Offset: 1

Views

Author

Henry Bottomley, May 15 2000

Keywords

Crossrefs

Programs

Formula

2, 3, 5 and numbers 30k +/- 1, 7, 11, or 13.
a(n+3) = 2*floor((3*floor((10*floor((9*n+1)/8)+8)/9)+1)/2)+1 for n>=1; see (19) in Diab link. - Michel Marcus, Dec 14 2020

A216240 Composite numbers arising in Eratosthenes sieve with removing the multiples of every other remaining numbers after 2 (see comment).

Original entry on oeis.org

9, 21, 33, 49, 51, 77, 87, 119, 121, 123, 141, 177, 187, 201, 203, 219, 237, 287, 289, 291, 309, 319, 327, 329, 357, 393, 413, 417, 447, 451, 469, 471, 493, 501, 511, 517, 543, 553, 573, 591, 633, 649, 669, 679, 687, 697, 721, 723, 737, 763, 771, 799, 803, 807
Offset: 1

Views

Author

Vladimir Shevelev, Mar 14 2013

Keywords

Comments

We remove even numbers except for 2. The first two remaining numbers are 3,5. Further we remove all remaining numbers multiple of 5,except for 5. The following two remaining numbers are 7,9. Now we remove all remaining numbers multiple of 9, except for 9, etc. The sequence lists the remaining composite numbers.
Conjecture. There exists x_0 such that for every x>=x_0, the number of a(n)<=x is more than pi(x).

Crossrefs

Programs

  • Mathematica
    Module[{a=Insert[Range[1,1000,2], 2, 2], k=4}, While[Length[a] >= 2k, a = Flatten[{Take[a,k], Select[Take[a,-Length[a]+k], Mod[#,a[[k]]] != 0 &]}]; k+=2]; Rest[Select[a,!PrimeQ[#]&]]] (* Peter J. C. Moses, Mar 27 2013 *)

A230773 Minimum number of steps in an alternate definition of the Sieve of Eratosthenes needed to identify n as prime or composite.

Original entry on oeis.org

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

Views

Author

Jean-Christophe Hervé, Oct 30 2013

Keywords

Comments

This sequence differs from A055399 on prime numbers; as they are never removed during the sieve, it is partly a matter of convention to decide at which step they are classified as prime. Because the smallest integer to be removed at step k is prime(k)^2, integers between prime(k)^2 and prime(k+1)^2 and not removed after step k are known as prime after this step.
This is how this sequence is defined for noncomposite numbers (primes and 1): for any noncomposite number n between prime(k)^2 and prime(k+1)^2, a(n) = k. An exception is made for 3 to fit the usual presentation of the sieve, according to which 3 is classified as prime after the first step, that is, a(3) = 1 (it can be argued, though, that running the first step of the sieve is not actually necessary to identify 3 as prime because 3 < prime(1)^2: see the comment on A000040 by Daniel Forgues, referring to 2 and 3 as "forcibly prime" since there are no integers greater than 1 and less than or equal to their respective square roots).

Examples

			By convention, a(1)=a(2)=0, as 1 is not involved in the sieve, and 2 is known as prime before the first step (first integer > 1).
At step 1, multiples of 2 are removed, beginning with 4 = 2*2; 5 and 7 are not removed and cannot be removed at any further step because they are less than 3*3 = 9; therefore, integers from 4 to 8 are all classified as prime or not prime after the first step: a(4) = a(5) = a(6) = a(7) = a(8) = 1.
At step 2, all integers < 5^2 = 25 will be classified because those >= 9 and not already classified at step one are either multiple of 3 or prime; therefore, for 9 <= n < 25, a(n) = 1 if n is even, a(n) = 2 if n is odd.
		

Crossrefs

Formula

a(n) = A010051(n)*(A056811(n) + mod(n^2,3))+(1-A010051(n))*A055396(n)
(that is, if n is prime > 3, a(n) = primepi(firstprimebelow(sqrt(n)); else if n is composite, a(n) = A055396(n)).
a(n) = A055399(n) - A010051(n)*mod(n^2,3).
Showing 1-4 of 4 results.