This is an old revision of the document!
Corning Community College
CSCS2330 Discrete Structures
Using the TIC-80 fantasy console simulator on your pi, implement a program that visually displays a range of values (lower and upper bounds adjustable by the user) that colorfully displays whether each value is a prime or composite value.
The algorithm you are to implement is the sieve of eratosthenes, which takes a completely different approach to prime/composite determination than the trial-by-division approach we've explored in pnf0/pnf1.
Time how long it takes to execute (displaying elapsed time for the run at its conclusion; this is useful for comparisons), and display this result, especially in relation to the work load and algorithm used.
Additionally, the entire class will be participating in documenting and filling out this project page. It is the responsibility of EACH class member to:
Originating in ancient Greece (probably), the Sieve of Eratosthenes is an mathematical algorithm for finding all prime numbers up to a given limit. The way the Sieve accomplishes this is by marking the multiples of each prime as composite (starting with 2, the first prime). Anything marked is known composite, and anything unmarked is tested. The algorithm then continues up until the root of the limit (say for a limit, N, of 100, the algorithm would continue up to 10). This is a little confusing at first, but here's a video explaining it well: https://www.youtube.com/watch?v=P__PsS2J_y8&t=3s
Note: in order to use the Sieve properly, you have to start at 2. Because of this, when calculating ranges which begin above 2 (for example, 5000-5010), the SoE may appear to actually be slower, as where the previous algorithms need only perform the calculations on 5000-5010, the SoE must calculate all of the primes from 2-5010. Barring implementation-specific edge cases, however, this new algorithm should always outperform the old ones even with full optimization enabled.
Given the speed of the SoE, the fun animated experience of many implementations may no longer be viable without severely handicapping old implementations and reworking animation code. As this algorithm may often finish by the time frame 1 is rendered (or whichever frame the calculation starts on), there is significantly less potential for animation (in fact, about 0) during the process of calculation. This does, however, still leave the possibility of post-finish animations on the table (rainbow numbers, flying unicorns, flashing, etc.) which may be well-worth exploring.
I'll be looking for the following:
78:pnf2:final tally of results (78/78) *:pnf2:no errors, program runs without issue in TIC-80 [13/13] *:pnf2:user can specify lower and upper bounds at runtime [13/13] *:pnf2:specified algorithms are implemented and functional [26/26] *:pnf2:timing of process is implemented, functional, shown [13/13] *:pnf2:project page contributions as per project specifications [13/13]
Additionally: