Pretty Pictures: Polynomial Progressions and their Primes By, Michael Mailloux Westfield State University [email protected] What is the Ulam Spiraland who is Ulam? ~Stanislaw Ulam was a 20th century, Polish mathematician, who moved to America at the start of WW2. ~Was a leading figure in the Manhattan project. ~Inventor of the Monte Carlo method for solving difficult mathematical problems. ~Creator of the Ulam Spiral. A brief History: Ulam first penned his spiral in 1963, when he became bored at a scientific meeting and began doodling! He then noticed that by circling the prime number there seemed to be

patterns. He was quoted as saying in reference to the spiral, appears to exhibit a strongly nonrandom appearance. The Spiral: This spiral which I will refer to as the Traditional Ulam Spiral, is an square shaped spiral of all positive integers. This traditional spiral is characterized by a growth in side length of the squares of 2-4-6-8- . The side length for each square starting with the inner most square can be written as: Side Length=2+2n, where n=0,1,2, is an ordered index of the side lengths starting with the smallest square. Prime Patterns of the Traditional Ulam Spiral Lines of the Spiral ~As it turns out the lines of the spiral can be represented with quadratic equations. But how do you find the physical equation from a spiral of numbers? The answer to this is by using difference charts! Step # Value

1st Difference 2nd Difference 3rd Difference 0 2 1 10 8 2 26

16 8 3 50 24 8 0 4 82 32 8

0 Differences, derivatives, and polynomials oh my? ~As it turns out you can use these difference charts to determine any quadratic or even higher degree polynomials if you want. For the Quadratic: Step # st Cubic: Value For1the Difference 0 2 1 10

8 2 26 16 , 2nd Difference 8 This equation is 3rd Difference Differences, derivatives, and polynomials oh my? ~These difference charts have a few significant commonalities to note.

1) For a quadratics the 2nd difference will never change, for cubics the 3rd difference will never change, for quartics the 4th difference will never change,etc. 2) The 2nd derivative of any quadratic can be used to confirm the 2nd difference 3) For the Traditional Ulam Spiral, the quadratic growth patterns we are concerned with were are those such that a=4. The Traditional Ulam Spiral The four main diagonals(denoted by , where n is the number the main diagonal starts on are: All quadratic progressions in the form of horizontal/vertical/diagonal lines can be classified using. b0(mod8): Follow the same direction as b1(mod8): Follow the same direction as the Horizontal line going left starting at 1 b2(mod8): Follow the same direction as b3(mod8): Follow the same direction as the Vertical line going up starting at 1. b4(mod8): Follow the same direction as

b5(mod8): Follow the same direction as the Horizontal line going right starting at 2. b6(mod8): Follow the same direction as b7(mod8): Follow the same direction as the Vertical line going down starting at 3. Other Variations of the Ulam Spiral ~By changing the growth rate for the side lengths of the square in the Ulam spiral it is possible to get different pictures for quadratic progressions. So far, progressions I have examined are such that: 1) Side Length 2-3-4, progression of 2+1n, n=0,1,2, ~4 diagonals ~a=2 2) Traditional 2-4-6, progression of 2+2n, n=0,1,2, ~8 diagonals ~a=4 3) Side Length 2-5-8, progression of 2+3n, n=0,1,2, ~12 diagonals ~a=6 4) Side Length 2-6-10, progression of 2+4n, n=0,1,2, ~16 diagonals ~a=8

Note: It should be seen by this point that by increasing the length of the 2nd square in the spiral by one integer that the leading coefficient a will increase by two integer values. This also tells us we can create spirals which can generate quadratics that start with any even positive leading a coefficient. 2-3-4 Spiral 2-3-4 Spiral (Primes) 2-3-4 Spiral ~ The quadratics of significance which represent the diagonals of this spiral examined all had the leading coefficient of a=2. ~ Diagonals can be sorted by direction using bx(mod4). 1) b0(mod4): Quadratics which will follow the same direction as the main diagonal starting at 2 2) b1(mod4):Quadratics which will follow the same direction as the main diagonal starting at 3 3) b2(mod4). Quadratics which will follow the same direction as the main diagonal starting at 4 4) b3(mod4). Quadratics which will follow the same direction as the main diagonal starting at 1

Traditional Ulam 2-4-6 The Traditional Ulam Spiral ~Like the previous spirals the vertical/horizontal/diagonal lines can be classified into categories based on the congruence of b. ~This spiral has a leading coefficient of a=4 ~Thus, the direction a quadratic progression will go is based on bx(mod8). 2-5-8 Spiral ~Like the previous spirals the vertical/horizontal/diagonal lines can be classified into categories based on the congruence of b. ~This spiral has a leading coefficient of a=6 ~Thus, the direction a quadratic progression will go is based on bx(mod12). 2-6-10 Spiral ~Like the previous spirals the vertical/horizontal/diagonal lines can be classified into categories based on the congruence of b. ~This spiral has a leading coefficient of a=8 ~Thus, the direction a quadratic progression will go is based on bx(mod16).

Odds and Evens ~When it comes to the search for the diagonals that can be seen when looking at pictures of the variations of the Ulam spiral, one thing that can be useful is taking a quadratic equation thats only outputs in the spiral are odd. Start with: Even Inputs: f(2x) Odd Inputs: f(2x+1) Start with: Even Inputs: f(2x) Odd Inputs: f(2x+1) Spiraling Quadratics ~While it is clear that many of quadratic progressions desirable to look at are merely vertical/horizontal/straight lines, there are some more Interesting ones which do not quite fit this mold. An example can be seen below of one of these spiraling progressions in the Ulam 2-3-4 spiral. Notice how despite seeming to jump around chaotically, it stabilizes into a diagonal eventually. In fact the jumping around isn't quite as random as it appears either.

Notice how this picture which highlights the positions of prime numbers, bolded is one of these quadratic progressions! This progressions is in fact modeled by, y=. Note: The b value of this equation b=2 categorizes this equation in the correct directional category based on the diagonal it settles on eventually! The Little Differences Make the Biggest Impacts X Y 1st Difference 2nd Difference 0 9

1 27 18 2 53 26 8 3 87 34 8 For this equation we will look at how the little differences behave. To start if the progression is to enter one of the main diagonals from 9 it would progress to either 23, 24, or 25.

(x=0) x y 0 9 1 23 1st 2nd 14 x y 8

0 9 8 1 24 1st 15 8 18-14=4 2nd x

y 8 0 9 8 1 25 1st 8 16 8

18-15=3 2nd 8 8 18-16=2 Since none of the little differences are zero the progression will not yet settle into a diagonal. The Little Differences Make the Biggest Impacts X Y 1st Difference 2nd Difference 0

9 1 27 18 2 53 26 8 3 87 34 8 Now we must repeat the process from before with 27 because none of our little differences were zero before.

(x=1) x y 1 27 2 51 1st 2nd 24 x y

8 1 27 8 2 52 1st 25 8 26-24=2 26-25=1

2nd x y 1st 2nd 8 1 27 8 2 53

26 8 8 3 87 34 8 8 26-26=0 Since the little difference is zero when the y-value goes from 27 to 53 we have found the diagonal our progression will settle on. Breaking Down the Spiraling Quadratics

~The reason these spirals are caused is because the quadratic progressions are growing at a faster or slower rate then any of the diagonals the quadratic can settle in. ~However, as the rate of growth of the legal diagonals becomes in sync, it can be seen that the quadratic progression will settle into the first legal diagonal which has the same rate of growth as the quadratic progressions at the moment. ~Once in one of the legal diagonals the quadratic progression will forever stay on the legal diagonal. ~ When breaking down the spirals it is best to look at an Ulam Spiral as being separated into quadrants broken up by the main diagonals. The Little Differences Make the Biggest Impacts ~We can also determine what the next start of the little differences based on the number of main diagonals crossed. An example of this can be seen below for the Traditional Ulam Spiral looking at the quadratic progressions of: y(1)->y(2) # of Main Start of the Diagonals little Less then differences 4 crossed +

Next start of little differences 1115 3 -12 +6 -6 1527 1 -6 +2

-4 2747 1 -4 +2 -2 4775 0 -2 +0 -2

75111 1 -2 +2 0 111155 0 0 +0 0 155207

0 0 +0 0 Note:# Diagonals less then 4 crossed does not include being on a main diagonal. The Little Differences Make the Biggest Impacts ~In this case for the Traditional Ulam Spiral, the number of main diagonals less then 4 crossed can be used to predict the next start of the little differences. Conversely, the next little difference start can be used to predict the number of main diagonals that were jumped to get to the next value. Traditional Ulam Little Difference next Start= Last Start+2|# of main diagonals less then 4 crossed| Main diagonals crossed= While this expresses the relation ship for the traditional Ulam Spiral, the relationship will change slightly depending on how fast the sides of the square grow.

Works Cited ~http://www.maa.org/devlin/devlin_04_09.html ~http://en.wikipedia.org/wiki/File:Stanislaw_Ulam_ID_badge.png ~ http://mathworld.wolfram.com/PrimeSpiral.html Thank You For Listening! The Little Differences Make the Biggest Impacts x y 1st 2nd 0 Z

X 1 K J X x y 0 1 1st 2nd x y

Z X 0 Z X K+1 J+1 X 1 K+2 J+2 X X

Actual first difference(D)-J=? 1st X D-(J+1)=? 2nd X D-(J+2)=? ~These little difference charts can be used to determine when the quadratic Progressions will settle into legal diagonals. To do this you take a step by Step approach and compare the y value to what the next y-value will be if the Progression will settle into one if the legal diagonals . If one of the D-(J+i)=0, then the quadratic progression will settle into that legal diagonal for good. If Of our little differences do not equal 0, then the quadratic will continue to dance Around the spiral. This same process is continued until, one of the little differences Is equal to zero.