Prime Number Spiral The User Manual, Part 3
3. Ascertaining the number at a location
If the size of a circle or a square in the grid is large enough, the number at that location is displayed within it. When the size is too small for the number to be displayed you can find out what the number is simply by clicking on that circle or square.
The pixel at the cursor position must not be black (sometimes numbers within a circle or square are displayed in black), so when clicking make sure that the cursor is over some colored pixel.
4. Square numbers
When only squares are displayed the following results with 1 as the central number:
When the central number increases the following pattern (here with central number = 25) emerges:
5. Triangular numbers
A number n is triangular if n objects can be arranged in a triangle, for example:
Triangular numbers can also be defined as ½*(n2 + n) for n ≥ 1. There is only one triangular prime number, namely, 3.
When only triangular numbers are displayed the following results with 1 as the central number:
6. Spiralling in and out
After the Ulam spiral has been displayed a new display may be obtained by increasing or decreasing (where possible) the central number. There are four ways to do this. The up and down buttons on the Start number box can be used to increase or decrease this number (provided the number is less than 32767). The graphics display is automatically updated.
A repeated increase or decrease of the central number is obtained by clicking on or on . (This is disabled for pixel size 1 because it takes too long to calculate 275,625 pixel values repeatedly.)
To see an animated gif (110 Kb) showing spiralling in click here.
Pause and resume
When spiralling in or out it is possible to pause and to resume:
Whilst paused the parameters, such as the color scheme, may be changed. The number of clock ticks per second can also be changed; this affects the rate at which the graphics screen is refreshed. Possible rates are 1, 2, 4, 8 and 12 clock ticks per second. This, however, is the maximum refresh rate. For smaller circles and squares (where there are a larger number of numbers to be processed and displayed) the refresh rate may be slower than the number of ticks per second.
7. Restricting the central number to be prime
If you check Show only for central number prime then when you use the up- and down-arrows to the right of the Start number box, and when you spiral in or spiral out, the software will display the spiral only when the central number is a prime, and will skip non-prime central numbers.
It may also be noted in passing that the up- and down-arrows do not work when the start number exceeds 32767 (due to a limitation in Visual Basic).
When Show only for central number prime is checked the up-arrow will not go beyond 32749, which is the largest prime not exceeding 32767, and the down-arrow will not go beyond 2, which is the smallest prime.
8. Measuring the longest diagonals
If you check the Calculate longest NW-SE, SW-NE box then after the spiral has been drawn the program will find the length of the longest diagonal of primes running NorthWest to SouthEast and SouthWest to NorthEast.
For example if the Ulam spiral is drawn with start number 1 and pixel size 21 then the number labeled as "Longest NW-SE" is the longest diagonal sequence on the grid running NW-SE (in this case 5; the sequence is 19, 7, 23, 47, 79). Similarly the number labeled as "Longest SW-NE" is the longest diagonal sequence on the grid running SW-NE (in this case also 5, the sequence 109, 71, 41, 19, 5). The two numbers are often not equal.
By default this box is unchecked, since for small pixel sizes it requires a noticeable amount of time to ascertain these lengths after the spiral has been drawn.
9. Random numbers
With the Show random numbers option a number n greater than 2 is shown if and only if it is odd and a computer-generated random number in the range (0,1) is greater than 1 - 2 / (0.5 + ln(n))), where ln() is the natural logarithm. This gives a distribution of random numbers which mimics that of the primes. n is used as the seed for the random number generator, so the distribution of random numbers is different for different n, but is constant for a given n.
This allows consideration of the question: Are the diagonal sequences a chance phenomenon? The answer would be yes if randomly selected odd numbers (or rather, randomly selected subject to the probability calculated in the manner described above) produced diagonal patterns very much like the patterns produced by the prime numbers.
This software allows the generation of many patterns of primes and random numbers, the better to consider this question. For example, the image at the left shows how the primes appear (using 5-pixel circles, starting at 101, and coloring by SW-NE diagonal) and the image at the right shows how random numbers appear (under the same configuration); this is approximately the SouthWest quadrant:
Prime numbers Random numbers
Clearly there is a difference, so it seems that there's something about those primes ...
Prime Number Spiral Curiosity
10. Saving images
Except when spiralling the image may be saved to a PNG file by means of a right mouse-click (when the cursor is over the image). This will bring up a dialog box asking if you wish to save the image. You can then select the name and location for the PNG file in which the image is to be saved:
Prime Number Spiral Hermetic Systems Home Page