Ron Mak @ Apropos Logic

ron@apropos-logic.com
Publications and books by Ronald Mak

Java Number Cruncher

Program 15-5

Prime Patterns

This applet demonstrates how patterns may appear in the distribution of the prime numbers. The applet does the following:

  1. 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.
  2. 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):

  1. Enter the size of the side of the square.
  2. Choose the path to lay out the integers.
  3. Enter the starting integer.
  4. Click the Run button.

The initial display will occur automatically.