This program demonstrates how patterns may appear in the distribution of the prime numbers. The program does the following:
- Lays out the consecutive integers in a square, one per point, along one of several possible paths:
- Spiralling outward in the counter-clockwise direction.
- Diagonally, starting from the upper left corner.
- Sequentially from left to right, row by row.
- Plots each point whose corresponding integer is prime.
Some patterns will appear as diagonal streaks. This is most visible with the spiral path starting with 41.
To run the demo (the controls are at the bottom of the screen):
- Enter the size of the side of the square.
- Choose the path to lay out the integers.
- Enter the starting integer.
- Click the Run button.
The initial display will occur automatically.