<s>
In	O
mathematics	O
,	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
an	O
algorithm	O
for	O
finding	O
all	O
prime	O
numbers	O
up	O
to	O
a	O
specified	O
bound	O
.	O
</s>
<s>
Like	O
the	O
ancient	O
sieve	B-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
,	O
it	O
has	O
a	O
simple	O
conceptual	O
basis	O
in	O
number	O
theory	O
.	O
</s>
<s>
Whereas	O
the	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
marks	O
off	O
each	O
non-prime	O
for	O
each	O
of	O
its	O
prime	O
factors	O
,	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
avoids	O
considering	O
almost	O
all	O
non-prime	O
numbers	O
by	O
building	O
progressively	O
larger	O
wheels	O
,	O
which	O
represent	O
the	O
pattern	O
of	O
numbers	O
not	O
divisible	O
by	O
any	O
of	O
the	O
primes	O
processed	O
thus	O
far	O
.	O
</s>
<s>
Since	O
Pritchard	O
has	O
created	O
a	O
number	O
of	O
other	O
sieve	O
algorithms	O
for	O
finding	O
prime	O
numbers	O
,	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
sometimes	O
singled	O
out	O
by	O
being	O
called	O
the	O
wheel	O
sieve	O
(	O
by	O
Pritchard	O
himself	O
)	O
or	O
the	O
dynamic	O
wheel	O
sieve	O
.	O
</s>
<s>
The	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
examines	O
all	O
of	O
the	O
range	O
,	O
first	O
removing	O
all	O
multiples	O
of	O
the	O
first	O
prime	O
,	O
then	O
of	O
the	O
next	O
prime	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
The	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
instead	O
examines	O
a	O
subset	O
of	O
the	O
range	O
consisting	O
of	O
numbers	O
that	O
occur	O
on	O
successive	O
wheels	O
,	O
</s>
<s>
which	O
represent	O
the	O
pattern	O
of	O
numbers	O
left	O
after	O
each	O
successive	O
prime	O
is	O
processed	O
by	O
the	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
.	O
</s>
<s>
The	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
derived	O
from	O
the	O
observation	O
that	O
this	O
holds	O
generally	O
:	O
</s>
<s>
So	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
starts	O
with	O
the	O
trivial	O
wheel	O
and	O
builds	O
successive	O
wheels	O
until	O
the	O
square	O
of	O
the	O
wheel	O
's	O
first	O
member	O
after	O
is	O
at	O
least	O
.	O
</s>
<s>
The	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
as	O
originally	O
presented	O
does	O
so	O
by	O
first	O
skipping	O
past	O
successive	O
members	O
until	O
finding	O
the	O
maximum	O
one	O
needed	O
,	O
and	O
then	O
doing	O
the	O
deletions	O
in	O
reverse	O
order	O
by	O
working	O
back	O
through	O
the	O
set	O
.	O
</s>
<s>
In	O
comparison	O
,	O
the	O
natural	O
version	O
of	O
Eratosthenes	B-Algorithm
sieve	I-Algorithm
(	O
stopping	O
at	O
the	O
same	O
point	O
)	O
removes	O
composite	O
numbers	O
184	O
times	O
.	O
</s>
<s>
The	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
can	O
be	O
expressed	O
in	O
pseudocode	B-Language
,	O
as	O
follows	O
:	O
</s>
<s>
Therefore	O
the	O
time	O
complexity	O
of	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
to	O
calculate	O
the	O
primes	O
up	O
to	O
in	O
the	O
random	B-Application
access	I-Application
machine	I-Application
model	O
is	O
operations	O
on	O
words	O
of	O
size	O
.	O
</s>
<s>
The	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
requires	O
only	O
1	O
bit	O
for	O
each	O
candidate	O
in	O
the	O
range	O
2	O
through	O
,	O
so	O
its	O
space	O
complexity	O
is	O
lower	O
at	O
bits	O
.	O
</s>
<s>
Therefore	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
not	O
competitive	O
as	O
a	O
practical	O
sieve	O
over	O
sufficiently	O
large	O
ranges	O
.	O
</s>
<s>
At	O
the	O
heart	O
of	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
an	O
algorithm	O
for	O
building	O
successive	O
wheels	O
.	O
</s>
<s>
Once	O
the	O
wheel	O
in	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
reaches	O
its	O
maximum	O
size	O
,	O
the	O
remaining	O
operations	O
are	O
equivalent	O
to	O
those	O
performed	O
by	O
Euler	O
's	O
sieve	O
.	O
</s>
<s>
The	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
is	O
unique	O
in	O
conflating	O
the	O
set	O
of	O
prime	O
candidates	O
with	O
a	O
dynamic	O
wheel	O
used	O
to	O
speed	O
up	O
the	O
sifting	O
process	O
.	O
</s>
<s>
But	O
a	O
separate	O
static	O
wheel	O
(	O
as	O
frequently	O
used	O
to	O
speed	O
up	O
the	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
)	O
can	O
give	O
an	O
speedup	O
to	O
the	O
latter	O
,	O
or	O
to	O
linear	O
sieves	O
,	O
provided	O
it	O
is	O
large	O
enough	O
(	O
as	O
a	O
function	O
of	O
)	O
.	O
</s>
<s>
Examples	O
are	O
the	O
use	O
of	O
the	O
largest	O
wheel	O
of	O
length	O
not	O
exceeding	O
to	O
get	O
a	O
version	O
of	O
the	B-Algorithm
sieve	I-Algorithm
of	I-Algorithm
Eratosthenes	I-Algorithm
that	O
takes	O
additions	O
and	O
requires	O
only	O
bits	O
,	O
and	O
the	O
speedup	O
of	O
the	O
naturally	O
linear	O
sieve	B-Algorithm
of	I-Algorithm
Atkin	I-Algorithm
to	O
get	O
a	O
sublinear	O
optimized	O
version	O
.	O
</s>
<s>
He	O
also	O
showed	O
how	O
to	O
make	O
it	O
sublinear	O
by	O
adapting	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
to	O
incrementally	O
build	O
the	O
next	O
dynamic	O
wheel	O
while	O
the	O
current	O
one	O
is	O
being	O
used	O
.	O
</s>
<s>
Pritchard	O
showed	O
how	O
to	O
avoid	O
multiplications	O
,	O
thereby	O
obtaining	O
the	O
same	O
asymptotic	O
bit-complexity	O
as	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
.	O
</s>
<s>
Runciman	O
provides	O
a	O
functional	O
algorithm	O
inspired	O
by	O
the	O
sieve	B-Algorithm
of	I-Algorithm
Pritchard	I-Algorithm
.	O
</s>
