Difference between revisions of "Sieve of Sundaram"
m |
m (→Generalization) |
||
Line 82: | Line 82: | ||
<cmath>%\begin{array}{ccccccccc} | <cmath>%\begin{array}{ccccccccc} | ||
− | c\slash d&1&7&11&13&17&19&23&29\ | + | %c\slash d&1&7&11&13&17&19&23&29\ |
− | 1& a+b&7a+b&11a+b&13a+b&17a+b&19a+b&23a+b&29a+b\ | + | %1& %a+b&7a+b&11a+b&13a+b&17a+b&19a+b&23a+b&29a+b\ |
− | 7&a+7b&7(a+b)+1&11a+7b+2&13a+7b+3&17a+7b+3&19a+ | + | %7&a+7b&7(a+b)+1&11a+7b+2&13a+7b+3&17a+7b+3&19a+7%b+4&23a+7b+5&29a+7b+6\ |
− | 11&a+11b&7a+11b+2&11(a+b)+4&13a+11b+4&17a+11b+6&23a+11b+8&53&54\ | + | %11&a+11b&7a+11b+2&11(a+b)+4&13a+11b+4&17a+11b+6&%23a+11b+8&53&54\ |
− | 13&62&63&64&65&66&67&68\ | + | %13&62&63&64&65&66&67&68\ |
− | 17&77&78&79&80&81&82&83&84\ | + | %17&77&78&79&80&81&82&83&84\ |
− | 19&92&93&94&95&96&97&98\ | + | %19&92&93&94&95&96&97&98\ |
− | 23&107&108&109&110&111&112&113&114\ | + | %23&107&108&109&110&111&112&113&114\ |
− | 29&122&123&124&125&126&127&128\ | + | %29&122&123&124&125&126&127&128\ |
− | \end{array}</cmath> | + | %\end{array}</cmath> |
Revision as of 10:40, 27 February 2020
Description
The Sieve of Sundaram is a sieve for a range of odd prime numbers.The sieve starts out listing the natural numbers to like the following example ()
Step 2
Then it finds all numbers of form ( fancy way of saying start at and increase by , for each not already eliminated ) and eliminates them (empty cells):
Step 3
Double each number and add one:
Basis
The basis of the algorithm is that for (without loss of generality, as the form we double and add 1 to is made up of commutative operations); with both factors nontrivial.
Optimization
The equivalent in Step 2 above, of the Sieve of Eratosthenes starting the at the next prime squared, is starting at for next index
Generalization
Looking close, if you know modular arithmetic, you'll note the remainder 1 forms the modular multiplicative group modulo 2. This generalizes to the modular multiplicative group mod any natural number( with loss of factors in the prime list). This generalization either needs copies of the same numbers ( one for each class), or (triangle numbers) colors . The class of remainder 1, is the only class where variable must stay nonzero to introduce a nontrivial factor by default ( negative representatives increase variable value required by 1). Modulo 30 is sketched out below (8 classes):
\[%\begin{array}{ccccccccc} %c\slash d&1&7&11&13&17&19&23&29\\ %1& %a+b&7a+b&11a+b&13a+b&17a+b&19a+b&23a+b&29a+b\\ %7&a+7b&7(a+b)+1&11a+7b+2&13a+7b+3&17a+7b+3&19a+7%b+4&23a+7b+5&29a+7b+6\\ %11&a+11b&7a+11b+2&11(a+b)+4&13a+11b+4&17a+11b+6&%23a+11b+8&53&54\\ %13&62&63&64&65&66&67&68\\ %17&77&78&79&80&81&82&83&84\\ %19&92&93&94&95&96&97&98\\ %23&107&108&109&110&111&112&113&114\\ %29&122&123&124&125&126&127&128\\ %\end{array}\] (Error compiling LaTeX. Unknown error_msg)