haas:spring2024:comporg:projects:pnc2
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:spring2024:comporg:projects:pnc2 [2024/04/11 09:49] – created - external edit 127.0.0.1 | haas:spring2024:comporg:projects:pnc2 [2024/04/18 10:46] (current) – [PNC2] wedge | ||
---|---|---|---|
Line 20: | Line 20: | ||
====PNC2==== | ====PNC2==== | ||
+ | {{: | ||
+ | |||
+ | Your next program, and first sieve, will be the Sieve of Eratosthenes. Perhaps among the best and likely longest-known sieves, its origins date from antiquity. | ||
+ | |||
+ | This sieve, instead of calculating to determine the eligibility of a prime, works in a manner of marking off patterns of values that cannot be prime (so, it is composite-focused in approach vs. prime-focused). | ||
+ | |||
+ | In order for it to work, we must store all the values we're processing so we can obtain what is left when done– what remains are the prime values. | ||
+ | |||
+ | Some refined considerations: | ||
+ | |||
+ | * include memory management related to the sieve in your timing | ||
+ | * for better visibility of performance, | ||
+ | * for graphing purposes, you may want to exclude the brute results, so your graphs do not suffer from needless compression (you want to see how soe performs against the better brute variants; at this point we already know it'll blow baseline brute out of the water) | ||
+ | * if the line graph is too noisy (too many things, not enough clear labels), consider doing a bar graph instead. | ||
+ | * you can, optionally, choose to bypass running brute once it surpasses a certain threshold; in my example, I set a threshold of 4 seconds, which is why you do not see results provided for 8192, as it'll have exceeded the limit during the 4096 run. | ||
+ | |||
+ | Here is the wikipedia page: | ||
+ | * https:// | ||
+ | |||
+ | Here is an animated image of this sieve in action (from wikipedia): | ||
+ | {{: | ||
=====EDIT===== | =====EDIT===== | ||
Line 73: | Line 94: | ||
*: | *: | ||
*: | *: | ||
- | *: | + | *: |
</ | </ | ||
haas/spring2024/comporg/projects/pnc2.1712843397.txt.gz · Last modified: 2024/04/11 09:49 by 127.0.0.1