Wheel factorization is a method for performing a preliminary reduction in the number of potential primes from the initial set of all natural numbers 2 and greater; possibly prior to passing the result list of potential primes to the Sieve of Eratosthenes or other sieve that separates prime numbers from composites, but may further be used as a prime number wheel sieve in its own right by recursively applying the factorization wheel generation algorithm.
Questions tagged [wheel-factorization]
9 questions
7
votes
2 answers
Adding wheel factorization to an indefinite sieve
I’m modifying an indefinite sieve of Eratosthenes from here so it uses wheel factorization to skip more composites than its current form of just checking all odds.
I’ve worked out how to generate the steps to take to reach all the gaps along the…

Status
- 912
- 1
- 12
- 23
5
votes
2 answers
2-3-5-7 wheel factorization seems to skip prime number 331
When following the procedure on wikipedia for wheel factorization, I seem to have stumbled into a problem where the prime number 331 is treated as a composite number if I try to build a 2-3-5-7 wheel.
With 2-3-5-7 wheel, 2*3*5*7=210. So I setup a…

Ants
- 2,628
- 22
- 35
4
votes
1 answer
Why does function apply complain about long lists?
As part of some Eulerian travails, I'm trying to code a Sieve of Eratosthenes with a factorization wheel. My code so far is:
(defun ring (&rest content)
"Returns a circular list containing the elements in content.
The returned list starts with the…

Paulo Mendes
- 697
- 5
- 16
4
votes
4 answers
Sieve of Eratosthenes with Wheel Factorization
I'm implementing a reasonably fast prime number generator and I obtained some nice results with a few optimizations on the sieve of Eratosthenes. In particular, during the preliminary part of the algorithm, I skip all multiples of 2 and 3 in this…

Crybot
- 107
- 3
- 8
1
vote
0 answers
Problem implementing wheels to sieve of Eratosthenes
I am a bit struggling with further optimizing my prime calculating function.
So far I ended up with the sieve of Eratosthenes.
I found on https://primesieve.org/ a hint to further optimize this with the implementation of wheels and a link to this…

FordPrefect
- 320
- 2
- 11
1
vote
0 answers
Inverting a Function in Sieve of Eratosthenes
I think this is technically wheel factorization. I'm trying to re-compress my program's representation of the Sieve of Eratosthenes, which only contains indexes of numbers which are possibly prime.
Some background:
The most basic wheel is [2]: keep…

Laurence Maddox
- 11
- 1
0
votes
3 answers
Program does not run faster as expected when checking much less numbers for finding primes
I made a program to find primes below a given number.
number = int(input("Enter number: "))
prime_numbers = [2] # First prime is needed.
for number_to_be_checked in range(3, number + 1):
square_root = number_to_be_checked ** 0.5
for…

PythonBeginner
- 45
- 1
- 7
0
votes
0 answers
Wheel Factorization & Sieve of Eratosthenes
I want optimize the sieve more further. I already have learnt wheel factorization from http://en.wikipedia.org/wiki/Wheel_factorization#Procedure. But i don't understand how can I implement wheel factorization in the sieve ?
bool…

Maruf
- 792
- 12
- 36
-2
votes
2 answers
need help about sieve of eratosthenes in free pascal
my teacher gave me this :
n<=10^6;
an array of n integer :ai..an(ai<=10^9);
find all prime numbers .
he said something about sieve of eratosthenes,and I read about it,also the wheel factorization too,but I still couldn't figure it out how to get the…

dang hoang
- 9
- 1