Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ThePrimeGlossary:SieveofEratosthenes
SieveofEratosthenes
(anotherPrimePages'Glossary
entries)
Glossary:
Index
Search
Home
Previous
Next
Random
MailEditor
PrimePages:
Home
Search
Index
FAQ
Top5000:
Primes
Provers
Curios
https://primes.utm.edu/glossary/page.php?sort=SieveOfEratosthenes
1/3
7/1/2015
ThePrimeGlossary:SieveofEratosthenes
whilep2<ndo{
j:=p2
while(j<n)do{
a[j]:=0
j:=j+p
}
repeatp:=p+1untila[p]=1
}
return(a)
}
Thismethodissofastthatthereisnoreasontostorealargelistofprimesona
computeranefficientimplementationcanfindthemfasterthanacomputercan
readfromadisk.Infacttheproblemwiththealgorithmaspresentedaboveisnot
reallyspeed(ituses O (n( log n)loglogn)bitoperations),butratherspace(itis
O(n)).Soforlargenweusuallyuseasegmentedsieve.However,boththetimeand
spacetheoreticallycanbeimprovedforexample,Pritchard's"linearsegmented
wheelsieve"usesO(nlogn)bitoperationsandO(sqrt(n)/loglogn)space.
SeeAlso: TrialDivision
Relatedpages(outsideofthiswork)
ProgramsandpseudocodeforTheSieveofEratosthenes
References:
BH77
C.BayesandR.Hudson,"ThesegmentedsieveofEratosthenes
andprimesinarithmeticprogression,"NordiskTidskr.
Informationsbehandling(BIT),17:2(1977)121127.MR
56:5405
Bressoud89
D.M.Bressoud,Factorizationsandprimalitytesting,Springer
Verlag,NewYork,NY,1989.ISBN0387970401.MR
91e:11150[pseudocodeimplementationonpage19]
[QA161.F3B73]
Pritchard87
P.Pritchard,"Linearprimenumbersieves:afamilytree,"Sci.
Comput.Programming,9:1(1987)1735.MR88j:11087
[Comparisonofvarioussieves][Acomparisonofrecentsieves
suchasthesieveofEratosthenes.]
Riesel94
H.Riesel,Primenumbersandcomputermethodsfor
factorization,ProgressinMathematicsVol,126,Birkhuser
Boston,Boston,MA,1994.ISBN0817637435.MR
95h:11142[aPASCALimplementationonpage6][Anexcellent
referenceforthosewhowanttostarttoprogramsomeofthese
algorithms.CodeisprovidedinPascal.Previouseditionwasvol.
57,1985.]
https://primes.utm.edu/glossary/page.php?sort=SieveOfEratosthenes
2/3
7/1/2015
ThePrimeGlossary:SieveofEratosthenes
ChrisK.Caldwell19992015(allrightsreserved)
https://primes.utm.edu/glossary/page.php?sort=SieveOfEratosthenes
3/3