This interactive CDF computes the Ulam Spiral for a given start value 0,1,2,.. which can also be negative. Interesting structures of the Ulam spiral can be seen on the 4 horizontal/vertical and 4 diagonal lines in the four quadrants. Those 8 lines belong to an startpoint, which can also be offset to the center of the Ulam spiral (see controls below). Thus the interesting lines containing many primes (which are located in som distance to the origin) can also be examined. The sequence functions for those 8 lines will be generated printed on demand. They have always the form f[n]=4n^2 + a*n +b.

Sequence values of these 8 sequence functions are tested for primality (and printed, if prime, see controls below..). The functions for these 8 lines are quadratic polynoms. Thus, it is clear, that the second order differences are constant values (8) . It turns out, that the sequence functions for the following pairs of lines can be generated by a single sequence-function:

horizontal-right/vertical-down, horizontal-left/vertical-up,

diagonal-right-up/diagonal-left-down

This is, however, not the case for the pair: diagonal-left-up/diagonal-right-down!

Setting tha start value in the center of the Ulam spiral to a value of 41 results in an impressive sequence of prime numbers lying on the diagonal line…

Note: You can also download the CDF from our download page!

Here is the interactive CDF: