Primes in Spirals By Cassie Gribble A Thesis Submitted to the Faculty of the DEPARTMENT OF MATHEMATICS In Partial Fulfillment of the Requirements For the Degree of MASTER OF MIDDLE SCHOOL MATHEMATICS LEADERSHIP In the Graduate College THE UNIVERSITY OF ARIZONA 2010 Abstract Prime numbers have been a fascination to mathematicians for ages. They seem to come in particular form. They do not seem to be distributed in any particular way. There is no one formula that will generate all prime numbers. They do not seem to follow any particular pattern, except maybe when looking at the prime numbers arranged in a spiral. 2 Identifying Primes Before looking at primes in spirals, you have to understand prime numbers, what they are, and how to identify them. Prime numbers are positive whole numbers that have only two factors, itself and one. An easy way to identify prime numbers is using the Sieve of Eratosthenes. If using a hundreds chart, begin with two and cross out all of the multiples of two, then continue with three and cross out all multiples of three not already crossed out, and the next consecutive numbers not crossed out will be five then seven. Once you have completed the multiples through seven, you can stop, only primes will be left. Always crossing out the multiples, but not the beginning number. When you have completed this process you are left with only prime numbers, which are highlighted below. 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 Figure 1. Primes using Sieve of Eratosthenes Another way to identify prime numbers is using modulus six. To find primes consider each multiple, m, of six and one greater and one less (mod 6+1 and mod 6+5) as possible primes. Test each possibility by dividing it by numbers that are ≤√m. All of the red numbers below are primes, with each arm being modulo 6 plus the number inside the circle. 3 Figure 2. A modulus-6 clock spiral showing the primes (red) to 90 http://www.chass.utoronto.ca/french/as-sa/ASSA-14/article7en.html Rectangular Array My task was to see what the longest string of prime numbers I could find in a regular rectangular array. I could change the width of the array or what I was counting by. All of the equations for these arrays are linear. There is a constant difference between each prime in the string. When counting by one with the array twenty-nine or thirty-one wide, I was able to find a string of six primes diagonally. There is a difference of thirty between the primes in both arrays. Below is a part of the array that shows the longest string. 4 1 2 3 4 5 6 7 8 9 10 11 12 13 30 31 32 33 34 35 36 37 38 39 40 41 42 59 60 61 62 63 64 65 66 67 68 69 70 71 88 89 90 91 92 93 94 95 96 97 98 99 100 117 118 119 120 121 122 123 124 125 126 127 128 129 146 147 148 149 150 151 152 153 154 155 156 157 158 175 176 177 178 179 180 181 182 183 184 185 186 187 204 205 206 207 208 209 210 211 212 213 214 215 216 Figure 3. Partial 30-column rectangular array string of 6 primes The equation for this string of primes is y=30x+7, this equation is linear because there is a difference of 30 between each prime and you add 7 since that is the first prime in this string. This same pattern also appeared on an array with nine columns, adding three to each number to get the next. 1 6 11 16 21 26 56 31 36 41 46 51 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 201 206 211 216 221 226 231 236 241 246 251 256 261 266 271 276 281 286 291 296 301 306 311 316 321 326 331 336 341 346 351 356 361 366 371 376 381 386 391 396 401 406 411 416 421 426 431 436 441 446 451 456 461 466 471 476 481 486 491 496 501 506 511 516 521 526 531 536 541 546 551 556 561 566 571 576 581 586 591 596 601 606 611 616 621 626 631 636 641 646 651 656 661 666 671 676 681 686 691 696 701 706 711 716 721 726 731 736 741 746 Another array that also has a string of six primes was on a six-column array and adding five to each number. All of the primes are in the first or third column. The beginning numbers for these columns are 1 and 11. Since I was adding five each time all the primes end with one. The equation is: y=30x+1, because there is a difference of thirty between each prime and you add the initial one from the beginning of the column. All of the primes are in the form of mod 6+1 in the first column or mod 6+5 in the third column. 5 Another array in the form of mod 6+1 or mod 6+5 was a six-column array of consecutive numbers. On this array all primes fell into the column under one or five with the exception of 2 and 3. The equation for that array was y=6x-1, (mod 6+5). The longest string had five primes of 5, 11, 17, 23, 29. On all of the arrays all of the prime numbers within a string, on the given chart work out to be either modulo 6+1 or modulo 6+5, but not both within one array. They do not have the same equations, but the difference between the primes in the string is always a multiple of six. The vertical string of primes on arrays that I found where this was the case also include these: 12 column array adding three to each number with an equation of y=36x-5, longest string had four primes of 31, 67, 103, 139; a 6 column array adding three to each number with an equation of y=18x+7, longest string had four primes of 43, 61, 79, 97; a 4 column array adding three to each number with an equation of y=12n-5, longest string had four primes of 7, 19, 31, 43; and a 6 column array of only odd numbers with an equation of y=12n-7, longest string had five primes of 5, 17, 29, 41, 53. The horizontal string of primes on arrays where the mod 6+1 or mod 6+1 applies includes: 12 column array of consecutive numbers with an equation of y=12n-7, longest string had five primes of 5, 17, 29, 41, 53 which is mod 6+5; 10 column array of odd numbers with an equation of y=18x-1, longest string had four primes of 53, 71, 89. 107 which is mod 6+5; 9 column array of odd numbers with an equation of y=18+7, longest string had four primes of 43, 61, 79, 97 which is mod 6+1; 9 column array adding three to each previous number with an equation of y=30x+7, longest string had six primes of 7, 37, 67, 97, 127, 157 which is mod 6+1; 11 column array of odd numbers with an equation of y=24n-11, longest string had four primes of 79, 103, 127, 151 which is mod 6+1; 6 column array 6 adding four to each previous number with an equation of y=24n-11, longest string had four primes of 349, 373, 397, 421 which is mod 6+1; 7column array adding five to each previous number with an equation of y=30x+11, longest string had four primes of 401, 431, 461, 491 which is mod 6+5; 7 column array of consecutive numbers with an equation of y=6x+1, longest string had four primes of 41, 47, 53, 59 which is mod 6+5; and 11 column array of consecutive numbers with an equation of y=12x-7, longest string had five primes of 5, 17, 29, 41, 53 which is mod 6+5. Spiral Arrays Another part of my problem was to find the longest string of prime numbers within a spiral. To spiral the numbers, I started with one in the center then moved out and around creating a spiral with the numbers. Again, I could change my beginning number and what I was counting by. Mathematician Stanislaw Ulam first discovered the spiral array of primes in 1963, while sitting in a meeting. He put the number 1 in the center and began spiraling out from the center with consecutive numbers. He then circled the prime numbers and found they tended to line up in a diagonal. Below is an Ulam spiral that contains a total of 160,000 integers. Prime numbers are the black pixels. There are 14,683 primes in this Ulam spiral. 7 Figure 5. Ulam Spiral, 1 to 160,000 I began using consecutive numbers with one at the center of the spiral. The longest string was a string of five primes. They did not go through the center of the spiral, nor did they have a consistent first difference, so it was not linear nor did it have a consistent second difference. The second difference was close to being the same, with only five primes in the string it is hard to be positive that the pattern would continue with the second differences being eight. If the pattern continued, then the spiral equation would be in the form of a quadratic. I came up with a quadratic equation that does not fit the first two numbers in the string, but does fit the last three numbers which is y=4x^2-4x-1. 8 90 89 88 87 86 85 84 83 82 121 57 56 55 54 53 52 51 50 81 120 58 31 30 29 28 27 26 49 80 119 59 32 13 12 11 10 25 48 79 118 60 33 14 3 2 9 24 47 78 117 61 34 15 4 1 8 23 46 77 116 62 35 16 5 6 7 22 45 76 115 63 36 17 18 19 20 21 44 75 114 64 37 38 39 40 41 42 43 74 113 65 66 67 68 69 70 71 72 73 112 102 103 104 105 106 107 108 109 110 111 Figure 6. Partial consecutive spiral starting with 1. I then continued with one in the center of the spiral building different spirals by adding different amounts to one and each previous number on each spiral. I created eight different spirals with one as the starting point. The longest string I was able to find was when I added six to each previous number within the spiral; I found a string of thirteen prime numbers. These primes did not go through the center of the spiral; they were left of the center. Again, the second difference was not consistent, the second difference of the first three numbers were different than the remaining primes in the string which had a second difference of forty-eight. As you can see in the spiral below the bottom two numbers in the string are not in order. When I dropped the numbers that are out of order, I could work with the remaining numbers to come up with an equation. The equation for this string is, y=24x^2+36x+43. The primes in green are all modulus 6+1. 9 3925 3331 2785 2287 1837 1831 1825 1819 1813 1807 1801 1795 1789 1783 3931 3337 2791 2293 1843 1441 1435 1429 1423 1417 1411 1405 1399 1393 3937 3343 2797 2299 1849 1447 1093 1087 1081 1075 1069 1063 1057 1051 3943 3349 2803 2305 1855 1453 1099 793 787 781 775 769 763 757 3949 3355 2809 2311 1861 1459 1105 799 541 535 529 523 517 511 3955 3361 2815 2317 1867 1465 1111 805 547 337 331 325 319 313 3961 3367 2821 2323 1873 1471 1117 811 553 343 181 175 169 163 3967 3373 2827 2329 1879 1477 1123 817 559 349 187 73 67 61 3973 3379 2833 2335 1885 1483 1129 823 565 355 193 79 13 7 3979 3385 2839 2341 1891 1489 1135 829 571 361 199 85 19 1 3985 3391 2845 2347 1897 1495 1141 835 577 367 205 91 25 31 3991 3397 2851 2353 1903 1501 1147 841 583 373 211 97 103 109 3997 3403 2857 2359 1909 1507 1153 847 589 379 217 223 229 235 Figure 7. Partial spiral array starting with 1 and adding 6 The spirals that did not go through the center caused me a lot of trouble. I kept trying to get my equation to fit all the numbers in the string, and I could not make it work, because the second differences were not all the same. I asked several people that I know for help and none of them could come up with an equation that would work. I used the table that I had created on my spreadsheet, I highlighted what my x and y axis would be and inserted a chart. Once the chart wizard opened, I selected a scatter plot. When the chart was created, I right-clicked on one of the data points and selected add trendline, I used a polynomial trend/regression line and showed the equation. When I finally dropped the beginning primes and focused on the ones that had a consistent second difference, I was able to generate an equation that would work for the remaining primes in the string. I kept creating different spirals with one in the center and never came up with any with a longer string of primes than thirteen. I finally decided to try different numbers other than one in the center and see what happened. I started off with placing eleven in the center and using consecutive numbers, this created a string of only ten primes in a string. All of these primes had a second difference of two, and the string went through 10 the center of the spiral. I then tried starting with seventeen, I found a string of sixteen primes, and again all the primes had a second difference of two, and went through the center of the spiral. Next I created a spiral starting with thirty-five. This spiral had a string of twenty primes; the string did not go through the center of the spiral. This was another spiral that caused me a lot of trouble. The first six primes in the string do not fall in order because of the spiraling. After the prime 173, the primes all fall in order and 280 281 282 283 284 285 286 287 288 221 222 223 224 225 226 227 228 229 170 171 172 173 174 175 176 177 178 127 128 129 130 131 132 133 134 135 92 93 94 95 96 97 98 99 136 65 66 67 68 69 70 71 100 137 64 47 48 49 50 51 72 101 138 63 46 37 38 39 52 73 102 139 Figure 8. Partial spiral starting with 35. have a difference of 8. Again, once I dropped the first six prime numbers in this string, I was able to come up with an equation of y=4x^2-2x+41 that would give me the rest of the prime numbers in the string. Another of the spirals I tried started with forty-one in the center, which has a string of forty primes through the center. This was the longest string that I found. The second difference of this string is two and the equation is y=x^2-x+41. 11 Mathematical Ideas It appears that when the string of primes goes through the center, the second difference remains constant throughout, when it does not go through the center the second differences are not constant in the beginning. The four spirals where I started with numbers other than one in the center all have the same pattern when looking at modulus 6 which is: mod 6+5, mod 6+1, mod 6+5, mod 6+5, mod 6+1… After finding a modulus pattern in the rectangular arrays first, I then looked for modulus patterns in the spirals, which I found. Although there are patterns within modulo and primes, there are no patterns within primes themselves. There is no one equation that will generate prime numbers. Within all of the different arrays I created, there are an equal number of equations, with each equation specific to a certain array. There are similar forms of equations, but no one specific equation will work for all. 12 Bibliography Charpentier, Michel. (2001) Prime numbers in PostScript. Retrieved from http://www.cs.unh.edu/~charpov/Programming/PostScript-primes/#first Marteinson, Peter. “Observations on the Regularity of Prime Distribution”. AS/SA No 14, Article 7. Retrieved from http://www.chass.utoronto.ca/french/as-sa/ASSA14/article7en.html Peterson, Ivars. Prime Spirals. Science News Magazine of the Society for Science & the Public. Retrieved from http://www.sciencenews.org/view/generic/id/2696/title/Prime_Spirals Rudd, H. (2010) UlamSpiral.com. A visual analysis of prime number distribution. Retrieved from http://ulamspiral.com/generatePage.asp?ID=1 Weisstein, Eric. (1999-2010) Prime Sprial. WolframMathWorld Research. Retrieved from http://www.maa.org/mathland/mathtrek_05_06_02.html Wells, David. (2005) Prime Numbers The Most Mysterious Figures in Math. Hoboken, NewJersey: John Wiley & Sons, Inc. Uittenbogaard, Arie. (2000-2007) 8.2 There’s Something About the Number Sequence – Ulam’s Rose or Prime Number Spiral. Retrieved from http://www.abarimpublications.com/artctulam.html Figure 2: http://www.chass.utoronto.ca/french/as-sa/ASSA-14/article7en.html Figure 5: http://mathworld.wolfram.com/PrimeSpiral.html 13 Appendix primes.xls 14