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.

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

This page as a plain text file.
%I A055399 #32 Aug 14 2024 08:35:26
%S A055399 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,
%T A055399 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,
%U A055399 5,1,5,1,2,1,4,1,5,1,2,1,5,1,3,1,2,1,5
%N A055399 Number of stages of sieve of Eratosthenes needed to identify n as prime or composite.
%C A055399 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
%H A055399 T. D. Noe, <a href="/A055399/b055399.txt">Table of n, a(n) for n = 3..10000</a>
%H A055399 H. B. Meyer, <a href="http://www.hbmeyer.de/eratosiv.htm">Eratosthenes' sieve</a>
%H A055399 J. Britton, <a href="https://web.archive.org/web/20170617094228/http://britton.disted.camosun.bc.ca/jberatosthenes.htm">Sieve of Eratosthenes Applet</a>
%H A055399 C. K. Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/page.php/SieveOfEratosthenes.html">Sieve of Eratosthenes</a>
%H A055399 Wikipedia, <a href="https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">Sieve of Eratosthenes</a>
%F A055399 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]
%F A055399 a(n) = A010051(n)*(A056811(n)+1)+(1-A010051(n))*A055396(n). - _Jean-Christophe Hervé_, Nov 01 2013
%e A055399 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.
%t A055399 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 *)
%Y A055399 Cf. A000040, A002808, A004280, A038179, A055396, A054403, A055398, A083269, A010051, A056811.
%K A055399 nice,nonn,easy
%O A055399 3,3
%A A055399 _Henry Bottomley_, May 15 2000