The Lewis Sieve: First Complicated Attempts... Now Defunct
The Lewis Sieve: Building Composites and Revealing Primes
This method is now defunct. I'm leaving it out as this is how I figured out how to do it. Basically, I found the 10's position closest to the number and knew there was a 2 and a 5. I used those positions to find the 3's and then just spread out in both directions... while it works, it's hard to code and not easy to understand. The news Lewis Sieve is just blitzing a list of mods through an area and factoring everything all at once with addition and subtraction. It's great.
Introduction
The Lewis Sieve is a method for “sifting” through a range of numbers (our window) to automatically build all the composite numbers from known factors. Any number in the window that we do not “build” must be prime. Today, we will use the window from 500 to 540 and choose 520 as our base number.
Why 520?
- It is composite.
- Its ending “20” immediately tells us it’s divisible by 2 and 5.
- These factors give us a solid starting point.
Our goal is to “propagate” from 520 by adding and subtracting its factors (and factors from numbers we build along the way) until we can “construct” every composite in the window. Any number we never construct will be prime.
Step 1: Propagation with the Factor 2 (Even Numbers)
Concept:
Every even number is composite because it is divisible by 2. We use 520 and add or subtract 2 repeatedly to “build” every even number in the window.
Procedure:
-
Subtracting 2 repeatedly from 520:
- 520 – 2 = 518
- 518 – 2 = 516
- 516 – 2 = 514
- 514 – 2 = 512
- 512 – 2 = 510
- 510 – 2 = 508
- 508 – 2 = 506
- 506 – 2 = 504
- 504 – 2 = 502
- 502 – 2 = 500
-
Adding 2 repeatedly from 520:
- 520 + 2 = 522
- 522 + 2 = 524
- 524 + 2 = 526
- 526 + 2 = 528
- 528 + 2 = 530
- 530 + 2 = 532
- 532 + 2 = 534
- 534 + 2 = 536
- 536 + 2 = 538
- 538 + 2 = 540
Result:
All even numbers from 500 to 540 are built:
500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540
Step 2: Propagation with the Factor 5 (Numbers Ending in 5)
Concept:
Since 520 is divisible by 5, we know numbers near 520 that end in 5 are composite. We “build” these by adding or subtracting 5 (or multiples of 5) from 520.
Procedure:
- 520 – 15 = 505
- 520 – 5 = 515
- 520 + 5 = 525
- 520 + 15 = 535
Result:
The numbers from the 5‑steps are:
505, 515, 525, 535
Step 3: Propagation with the Factor 3
Concept:
Many even numbers (for example, 504, 510, 516, 522, 534, and 540) are multiples of 3. We can “fill in” nearby odd composites by stepping by 3.
Procedure:
From each even composite that is divisible by 3, subtract 3 (or add 3 if needed):
- From 504: 504 – 3 = 501
- From 510: 510 – 3 = 507
- From 516: 516 – 3 = 513
- From 522: 522 – 3 = 519
- From 534: 534 – 3 = 531
- From 540: 540 – 3 = 537
Result:
The numbers from the 3‑steps are:
501, 507, 513, 519, 531, 537
Step 4: Propagation with the Factor 7
Concept:
Some composites in our list already have a factor of 7. For example, 504 and 518 are divisible by 7. We can use these to fill in additional composites by subtracting 7.
Procedure:
- From 518: 518 – 7 = 511
(Note: 518 + 7 = 525, but 525 is already built via the 5‑steps.)
Result:
The number from the 7‑step is:
511
Step 5: Propagation with Higher Prime Factors (11, 13, 17, 23, and 19)
Concept:
After the basic steps, we look at higher prime factors that appear in the factorizations of our built composites. These factors help us “reach out” further in our window.
Propagation with 11
- Observation:
506 factors as 2 × 11 × 23. - Procedure:
- 506 + 11 = 517
- Procedure:
- 528 – 11 = 517 (again)
- 528 + 11 = 539
Result from 11:
517, 539
Propagation with 13
- Observation:
520 factors as 2³ × 5 × 13. - Procedure:
- 520 + 13 = 533
Result from 13:
533
Propagation with 17
- Observation:
510 factors as 2 × 3 × 5 × 17. - Procedure:
- 510 + 17 = 527
Result from 17:
527
Propagation with 23
- Observation:
From 506 = 2 × 11 × 23. - Procedure:
- 506 + 23 = 529
Result from 23:
529
Propagation with 19
- Observation:
513 factors as 3³ × 19. - Procedure:
513 + 19 = 532 (already in our even list) and 513 – 19 = 494 (below 500).
So propagation with 19 yields no new number in our window.
Step 6: Combining All the Propagated Numbers
Now, we merge the numbers from every propagation step and sort them. Our composite list “built” in the window 500–540 is:
-
Even Numbers (2’s):
500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540 -
Numbers Ending in 5 (5’s):
505, 515, 525, 535 -
3’s Propagation:
501, 507, 513, 519, 531, 537 -
7’s Propagation:
511 -
Higher Primes Propagation:
From 11: 517, 539
From 13: 533
From 17: 527
From 23: 529
Combined Sorted List:
500, 501, 502, 504, 505, 506, 507, 508, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 522, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540
Step 7: Identifying the Missing Numbers (Primes)
Now, let’s list all the numbers from 500 to 540:
500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540
Comparing with our composite list, the numbers that were not built by our propagation are:
503, 509, 521, 523
These are the primes in the window 500–540 according to the Lewis Sieve method.
Conclusion
Summary of the Process:
-
Start with 520:
A composite number with clear factors (2 and 5). -
Propagate by 2:
Generate every even number in the window (500 to 540). -
Propagate by 5:
Generate numbers ending in 5 by adding/subtracting 5 (and multiples like 15). -
Propagate by 3:
From even numbers that are multiples of 3, subtract 3 to build additional composites. -
Propagate by 7:
From numbers with a factor of 7 (like 518), subtract 7 to create more composites. -
Propagate with Higher Primes:
Use factors that appear in the factorizations (11, 13, 17, 23) to extend the list further:- From 11: get 517 and 539
- From 13: get 533
- From 17: get 527
- From 23: get 529
-
Combine and Sort:
Merge all numbers built from the above steps. Any number in the complete window (500–540) that is missing is prime. -
Identify the Primes:
In our window, the numbers not “built” are 503, 509, 521, and 523.
Final Note to Students
This method shows that if you can “build” a number by starting with a composite and propagating its factors (adding or subtracting those factors appropriately), then that number is composite. The numbers that are never “built” by this process are prime. This is the essence of the Lewis Sieve method, and it provides an intuitive way of understanding the structure of composites and the nature of primes.