Download Sample Past Writing - Math

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Quadratic reciprocity wikipedia , lookup

List of prime numbers wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
SAMPLES OF HIGHER RATED WRITING: LAB 4
1. Task Description
Lab report 4. (March 12) Prime Numbers. Following the guidelines, and keeping in mind the
assessment criteria, using where appropriate experimental examples, graphics, or mathematical
proofs, introduce the reader to Prime numbers. Give special attention to: Questions 9 through
16. Additional points to cover: (21) For the prime subtraction game: Define the game, and
determine for which prime numbers N player ONE has a winning strategy, and for which prime
numbers N player TWO has a winning strategy. Give illustrative examples. (22) For the questions
about magic squares with prime number entries raised in the slides, survey for the reader what
is known and supplement to the extent possible with your own experiments and conjectures or
proofs. Could all entries of a prime magic square be Mersenne prime numbers? Could all entries
of a magic square be prime numbers that are members of a pair of twin primes? (Links appearing
in the slides may be useful in exploring questions about Magic Squares of prime numbers.)
2. Introduction
Example 1
Prime numbers are used heavily in number theory and cryptography. They have been systematically
investigated since at least 300 B.C., by Euclid and others. Today, a quick Google search reveals that multimillion digit prime numbers are known, with many intermediate sized primes skipped over, undiscovered, and
too plentiful to record. Prize money is offered for finding even larger prime numbers, with many volunteers
donating computer processor power to the chase. Curiosity has surrounded the many ways to efficiently
produce them, as well as their distribution in the natural numbers. This report discusses some ways to
produce a long list of primes, investigates the efficiency of each method, and discusses patterns observed in
the process.
A number is prime if and only if it is an integer that is divisible only by itself and 1, with no remainder.
When mathematicians conjecture that they discovered a new prime number generator, they or others name
the method after them. The primes that can be generated by that method are then classified under that
name. An example is the Mersenne primes, generated by 2n − 1. Although 24 − 1 is not prime, the primes
that can be expressed in this form, such as 25 − 1 = 31, carry the name, with prime n being a requirement,
but not a guarantee, for success.
The slowest way to determine if a number is prime is to divide the natural numbers from 1 to n one at a
time into the number, searching for factors. A faster way to determine if n is prime is to assume that if there
is a factor
√ must be at least 2 factors,
√ a and b, such that a ≤ b and ab = n. Only a
√ other than 1 or n, there
time is saved by only trying prime
up to n need be tried. If b > n, then a must be less than n. Further√
a. However, this requires knowing all the prime numbers between 1 and n, which are not known for large
n.
There is a well known much faster way for determining if a number is prime, without needing to know
the primes smaller than it. That method does not speed up the factoring of non-primes, though. For this
reason, one type of cryptography uses the product of two large primes as the key. Someone who knows one
of the primes can quickly calculate the other, but someone who does not yet know either would have to try
dividing prime numbers into it to factor the product. Even for 50 digit prime numbers, this would take more
than the lifetime of the universe with the above method and modern computers. This raises the question,
"What is more valuable: a very large prime found by a common method, or an intermediate sized prime
found with a proprietary method?"
Sample 2
Introduction
Surely, most of us have heard of prime numbers at some point in our lives. One very prominent example
where prime numbers are mentioned is in the centre of the Fundamental Theorem of Arithmetic, which,
while it may not have been formally introduced by its name, is encountered by many of us in our early education. The Fundamental Theorem of Arithmetic states that every integer larger than one can be written as
a unique product of primes, or, in other words, every integer larger than one has a unique set of prime factors
(sometimes called a prime factorization). However, when we encounter the notion of a prime number in this
context, we are not necessarily given any interesting information about the prime numbers themselves. As
it turns out, there are many interesting results and open questions regarding prime numbers, so the purpose
of this paper is to provide a meaningful introduction to the prime numbers themselves.
First, it is important to make explicit what is really meant by the phrase "prime number." A prime
number is an integer that only has two unique factors, 1 and itself. Conversely, we call an integer that is
not prime composite. That is, a number is composite if it can be written as a product of multiple prime
Date: February 18, 2015.
1
numbers. Equivalently, we can think of prime and composite numbers in terms of divisibility. If an integer
is only divisible by 1 and itself, then it is a prime number, and likewise if an integer is divisible by a smaller
integer (not equal to 1) then it is a composite number.
We can define prime numbers more formally in the following way: Let D(a) = {b ∈ Z+ : b|a} be the set of
all positive integers b which evenly divide the positive integer a. Then, a is prime if and only if D(a) = {1, a},
which means that, necessarily, the set D(a) has exactly two elements. (Under this definition it is easy to see
that 1 is not a prime number, as D(1) = {1}.) Then, for a composite number b, it also follows that the set
D(b) will never have exactly two elements.
Theory
The first fact that ought to be established, which is also one of the very first results ever discovered for
the prime numbers, is that there are infinitely many primes. One proof, characteristic of the first proof
which was published by Euclid, the ancient Greek mathematicians, follows naturally from the Fundamental
Theorem of Arithmetic, which was introduced at the very beginning of the essay. Euclid’s proof proceeds
similar to the following:
Proof. Assume, for contradiction, that the list of all primes is finite, say, p1 , p2 , . . . pn .
Now, let N = p1 p2 . . . pn + 1. By the fundamental theorem of arithmetic, N can be expressed as a product
of primes.
Case 1: If N is prime, then there is a contradiction, as clearly N is not equal to any of the numbers
p1 , p2 , . . . pn .
Case 2: If N is not prime, then N can be expressed as a product of multiple primes. However, if there are
only finitely many primes p1 , p2 , . . . pn which can divide N , it must be the case that, for some p, p|1, which
is another contradiction.
Therefore, there must be infinitely many primes.
Now, let’s examine some more in-depth questions about prime numbers.
1. How do we generate prime numbers?
Now that we have a solid grasp on what it means to say that an integer is a prime number, our next goal
is to look for a feasible way to find prime numbers. While it may seem like we could sit down and list all of
the integers greater than one and individually check to see if every integer k in our list is divisible by any
integer other than k or 1, doing such a thing would both be very tedious and require infinite time. So, while
that process may sound fun to some, it is clear that looking for a more efficient way to obtain a list of prime
numbers is a question worth pursuing.
The first possibility we will look at is the use of linear expressions, which take the form f (x) = ax + b
where a, b ∈ Z+ . Luckily, we have a nice theorem that lets us know when we will be able to get prime
numbers out of a linear expression.
Theorem 1 (Dirichlet’s Theorem). The set S = ax + b : x ∈ N contains infinitely many prime numbers if
and only if gcd(a, b) = 1.
The proof of this theorem is by no means simple or trivial, and for this reason we will simply accept
the truth of Dirichlet’s theorem for the purposes of this essay. However, the proof can be found using the
references at the end of this text. [2]
Now that we know by Dirichlet’s theorem that, with the right choice of integers a and b, we can obtain a
set containing infinitely primes by defining a linear function ax + b, we can turn our attention to quadratic
expressions, which take the form f (x) = ax2 + bx + c where a, b, c ∈ Z+ . Unfortunately, as of the date of
this essay, there has been no result definitively proving that a quadratic expression will produce infinitely
many prime numbers under certain conditions. However, conjectures still have been made about when these
expressions will generate a set containing an infinite number of primes.
The Bunyakovsky Conjecture proposes that the following three conditions are sufficient for a polynomial f (x) with integer coefficients to produce infinitely many prime values:
(1) f (x) has a positive leading coefficient,
(2) The polynomial f (x) is irreducible, and
(3) The coefficients of f (x) are relatively prime (thus, the outputs produced by consecutive natural numbers
in f (x) will also be relatively prime).
Should someone find a proof for Bunyakovsky’s conjecture, we will have not only a set of sufficient conditions for a quadratic expression to generate infinitely many prime outputs, but we will have a set of necessary
conditions for polynomials of any degree to produce infinitely many primes. However, as of the date of this
essay, the only case of Bunyakovsky’s conjecture which as been successfully proven is that for first-degree
polynomials, and this is Dirichlet’s theorem, which we discussed above.
Unfortunately, it is not the case for any polynomial generating prime numbers that it will only generate
prime numbers, but we can examine which polynomial functions will produce the longest string of consecutive prime numbers. Then, we can ask which integer coefficients produce longer consecutive strings of prime
numbers as outputs. This question will be examined and discussed with some numerical results in the next
2
session of the essay.
Before moving on to numerical results, however, it is important to consider one more set of questions
about the primes.
2. Categorizing Prime Numbers
Another question about prime numbers that arises is whether or not the set of all prime numbers can
be separated into meaningful subsets based on some specific properties. For example, we can separate the
natural numbers into two groups, even and odd, and we can separate the integers into positive and negative.
So, the question we address now is whether there exists some simple property that only a proper subset of
the primes has. Then, we could use this property to define two subsets of the primes: those for which the
specified property holds, and those for which it does not.
First, consider the general properties of prime numbers. With the exception of 2, all prime numbers must
be odd, which is easy to see by noting that every other even number is divisible by at least 1, 2, and itself, so
every even number greater than 2 necessarily has more than 2 unique factors. This leads to a less intuitive
property that, if we look at any given prime number greater than 2, in addition to being odd, it must be
congruent to either 1mod4 or 3mod4. This observation motivates the following result:
Theorem 2 (Fermat’s Big Theorem). For an integer m > 2, there exists a unique pair of positive integers
(x, y) with x < y such that m = x2 + y 2 if and only if m is prime and m ≡ 1mod4.
This too is a theorem whose proof is not simple. In fact, Fermat himself was not the one who proved
it, and a conjecture was even made that this theorem could not be proven. However, the work of multiple
mathematicians over a span of many years has led to a proof of Fermat’s theorem. A complete history and
proof can be seen in the references [3], but for our purposes in this essay, it suffices to simply assume that
the proof works.
The result given to us by Fermat’s Big Theorem reveals that there is an interesting property which belongs only to a specific subset of primes, that is, any prime number congruent to 1mod4. This is enough to
motivate the definition of three distinct subsets of the prime numbers as follows:
Let P denote the set of all prime numbers. Then, let P1 denote the set of all prime numbers congruent to
1mod4, and define P2 and P3 similarly.
Now, we can write these subsets formally as follows:
P1 = {p ∈ P : p ≡ 1mod4}
P2 = {2} (trivially)
P3 = {p ∈ P : p ≡ 3mod4}
By looking at the formal definition of each subset of P , it is easy to see the relationship that P =
P[ 1](n) ∪ P2 ∪ P3 (n) as well as the relationships P1 ∩ P3 = ∅, P1 ∩ P2 = ∅, P3 ∩ P2 = ∅, and P1 ∩ P2 ∩ P3 = ∅
are all true and follow from the above definitions.
Now that the sets P, P1 , P2 , and P3 have been defined, we will examine the cardinality, or number of
elements in each respective set. First, note that there is clearly only 1 element in P2 , so we will focus our
analysis only on P1 and P3 in relation to P when discussing the size of each set.
It will be useful here to introduce a new function, called the "prime-counting" function. Let π(n) equal
the total number of primes less than or equal to the integer n. Likewise, π1 (n) equals the total number
of primes in π(n) congruent to 1mod4 and π3 (n) equals the total number of primes in π(n) congruent to
3mod4. Thus, we can see that π(n) = π1 (n) + π3 (n) + 1. Note that we have added a "+1" to account for
the number 2, which is accounted for in π(n) but not π1 (n) or π3 (n). We will discuss the prime-counting
functions in more detail in the next section.
Sample 3
Sample 4
3. Technical Findings
3.1. Question 9.
Sample 1
Write a program that runs all integers n between 0 and a positive integer k through the equation n2 + n + 41
and outputs all n that result in a prime answer. For k = 10, 20, 30, 40, 50, what observations can you make?
We have here a program written in SageMath that performs the requested task.1
1
2 def eulercheck(k):
3
primes=[]
4
for i in range(k):
5
x = i^2 + i + 41
6
if is_prime(x):
7
primes.append(i)
1The program takes an input k and runs all integers 0 ≤ n < k.
3
8
return primes
We then ran the program for k = 10, 20, 30, 40, 50 and got the following lists (in that respective order).
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 46, 47, 48]
For all n ∈ Z : 0 ≤ n < 40, the output of the function f (n) = n2 + n + 41 is prime, a remarkable streak.
However, the streak unfortunately ends at n = 40, as evidenced by the list generated by k = 50. Why would
it stop now? Well, let’s look at n = 40. In this case, f (n) = 1681 = 412 ; Notice that f (40) = 402 + 40 + 41 =
40 ∗ 41 + 41 = 412 . A similar problem occurs at n = 41; f (41) = 412 + 41 = 41 = 41(41 + 1 + 1) = 41 ∗ 43.
Nonetheless, a 40-streak of prime outputs (0-39) is an impressive feat.
Sample 2
2
When a, b = 1 and c = 41 [in ax + bx + c], the following was found for the first 1000 inputs [values of x].
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 83, 85, 86, 88, 90, 92, 93, 94, 95, 97, 98, 99, 100, 101,
103, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 118, 119, 120, 124, 125, 128, 129, 131, 132, 133,
134, 135, 137, 139, 141, 142, 144, 145, 146, 148, 149, 150, 151, 152, 153, 154, 156, 157, 158, 160, 165, 166,
167, 168, 169, 171, 174, 175, 176, 177, 179, 180, 181, 182, 183, 188, 189, 191, 192, 193, 194, 195, 196, 197,
198, 199, 200, 202, 203, 206, 210, 211, 212, 214, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
231, 233, 235, 238, 240, 241, 243, 247, 250, 253, 254, 257, 258, 260, 262, 263, 264, 267, 269, 272, 273, 274,
275, 276, 277, 280, 281, 282, 285, 288, 290, 292, 293, 294, 297, 303, 304, 305, 306, 307, 308, 310, 311, 313,
315, 316, 317, 318, 319, 320, 322, 323, 324, 332, 333, 335, 337, 339, 340, 341, 343, 346, 348, 350, 351, 352,
353, 354, 355, 356, 358, 359, 362, 363, 365, 366, 371, 372, 375, 376, 377, 379, 382, 384, 386, 387, 390, 391,
392, 393, 394, 396, 397, 398, 400, 403, 404, 405, 411, 412, 413, 414, 415, 417, 419, 423, 424, 426, 429, 430,
433, 434, 435, 436, 437, 438, 439, 441, 444, 446, 447, 448, 452, 453, 455, 456, 457, 458, 461, 462, 464, 465,
468, 469, 470, 475, 476, 478, 479, 482, 484, 485, 486, 488, 490, 493, 495, 497, 498, 499, 501, 503, 505, 508,
509, 510, 511, 512, 513, 515, 518, 520, 521, 522, 523, 525, 528, 529, 534, 535, 536, 537, 538, 539, 540, 541,
542, 543, 548, 549, 550, 551, 552, 554, 555, 558, 559, 564, 565, 567, 568, 572, 575, 576, 580, 581, 584, 588,
590, 591, 592, 594, 595, 596, 597, 598, 599, 601, 602, 604, 606, 607, 610, 617, 618, 619, 621, 623, 625, 626,
627, 629, 631, 634, 635, 637, 638, 640, 641, 647, 648, 649, 650, 651, 653, 654, 658, 659, 667, 668, 672, 673,
674, 677, 678, 681, 683, 684, 687, 688, 690, 691, 694, 695, 698, 700, 705, 706, 708, 709, 710, 712, 713, 714,
717, 718, 719, 720, 722, 723, 724, 725, 726, 728, 730, 731, 735, 741, 742, 743, 746, 748, 751, 755, 756, 757,
759, 760, 762, 763, 766, 770, 771, 774, 777, 780, 781, 785, 787, 789, 792, 793, 794, 802, 804, 805, 806, 808,
809, 810, 811, 812, 813, 817, 821, 826, 828, 829, 830, 831, 832, 833, 837, 838, 839, 840, 841, 842, 845, 850,
852, 855, 859, 862, 863, 864, 866, 868, 870, 871, 872, 873, 875, 877, 879, 882, 883, 884, 886, 887, 888, 889,
893, 894, 899, 900, 903, 908, 909, 911, 913, 914, 920, 921, 923, 927, 929, 930, 931, 932, 933, 934, 935, 936,
938, 939, 941, 945, 946, 948, 949, 952, 953, 954, 958, 960, 961, 964, 965, 967, 968, 969, 970, 973, 974, 975,
976, 979, 985, 991, 992, 993, 994, 996, 998
This function produces very impressive results!. One thing that we noticed though was that the there are
breaks in the numbers. For instance, the first break happens at 40.
3.2. Question 10.
Sample 1
2
Modify the program to test the polynomial x − 79x + 1601 for k = 10, 20, 30, 40, 50, 60, 80and90. What do
you observe in this case? Can you explain what you observe?
Here is the modified program:
1
2 def newlercheck(k):
3
primes=[]
4
for i in range(k):
5
x = i^2 - 79*i + 1601
6
if is_prime(x):
7
primes.append(i)
8
return primes
As the lists generated by k = 10, 20, 30, 40, 50, 60, 70, 80 are all sub-lists of k = 90, we here show the list
for k = 90.
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 82, 83, 85, 86, 87, 88]
As evidenced by the list, the function g(n) = n2 − 79n + 1601 generates prime numbers for an 80integer streak! For all n ∈ Z : 0 ≤ n < 80, g(n) is prime. However, the streak isn’t perfect; g(80) =
802 − 79 ∗ 80 + 1601 = 80 + 1601 = 1681 = 412 .
Sample 2
4
The second function that the book suggested we take a look at is when a = 1, b = −79, and c = 1601. This
function generated the following output.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 82, 83, 85, 86, 87, 88, 90, 91, 92,
93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119,
120, 123, 125, 126, 128, 130, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 145, 146, 147, 148, 150, 151,
152, 153, 154, 155, 156, 158, 159, 160, 164, 165, 168, 169, 171, 172, 173, 174, 175, 177, 179, 181, 182, 184,
185, 186, 188, 189, 190, 191, 192, 193, 194, 196, 197, 198, 200, 205, 206, 207, 208, 209, 211, 214, 215, 216,
217, 219, 220, 221, 222, 223, 228, 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 246, 250,
251, 252, 254, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 273, 275, 278, 280, 281, 283,
287, 290, 293, 294, 297, 298, 300, 302, 303, 304, 307, 309, 312, 313, 314, 315, 316, 317, 320, 321, 322, 325,
328, 330, 332, 333, 334, 337, 343, 344, 345, 346, 347, 348, 350, 351, 353, 355, 356, 357, 358, 359, 360, 362,
363, 364, 372, 373, 375, 377, 379, 380, 381, 383, 386, 388, 390, 391, 392, 393, 394, 395, 396, 398, 399, 402,
403, 405, 406, 411, 412, 415, 416, 417, 419, 422, 424, 426, 427, 430, 431, 432, 433, 434, 436, 437, 438, 440,
443, 444, 445, 451, 452, 453, 454, 455, 457, 459, 463, 464, 466, 469, 470, 473, 474, 475, 476, 477, 478, 479,
481, 484, 486, 487, 488, 492, 493, 495, 496, 497, 498, 501, 502, 504, 505, 508, 509, 510, 515, 516, 518, 519,
522, 524, 525, 526, 528, 530, 533, 535, 537, 538, 539, 541, 543, 545, 548, 549, 550, 551, 552, 553, 555, 558,
560, 561, 562, 563, 565, 568, 569, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 588, 589, 590, 591, 592,
594, 595, 598, 599, 604, 605, 607, 608, 612, 615, 616, 620, 621, 624, 628, 630, 631, 632, 634, 635, 636, 637,
638, 639, 641, 642, 644, 646, 647, 650, 657, 658, 659, 661, 663, 665, 666, 667, 669, 671, 674, 675, 677, 678,
680, 681, 687, 688, 689, 690, 691, 693, 694, 698, 699, 707, 708, 712, 713, 714, 717, 718, 721, 723, 724, 727,
728, 730, 731, 734, 735, 738, 740, 745, 746, 748, 749, 750, 752, 753, 754, 757, 758, 759, 760, 762, 763, 764,
765, 766, 768, 770, 771, 775, 781, 782, 783, 786, 788, 791, 795, 796, 797, 799, 800, 802, 803, 806, 810, 811,
814, 817, 820, 821, 825, 827, 829, 832, 833, 834, 842, 844, 845, 846, 848, 849, 850, 851, 852, 853, 857, 861,
866, 868, 869, 870, 871, 872, 873, 877, 878, 879, 880, 881, 882, 885, 890, 892, 895, 899, 902, 903, 904, 906,
908, 910, 911, 912, 913, 915, 917, 919, 922, 923, 924, 926, 927, 928, 929, 933, 934, 939, 940, 943, 948, 949,
951, 953, 954, 960, 961, 963, 967, 969, 970, 971, 972, 973, 974, 975, 976, 978, 979, 981, 985, 986, 988, 989,
992, 993, 994, 998
The above has fewer breaks than the previous function, but notice that breaks are still present. For instance,
there is a break at 121. The breaks continue throughout.
There has yet to be, or at least we are unaware of, a proof that there is a limit to the length of sequentail
primes generated by quadratic functions.
3.3. Question 11.
Sample 1
2
By hand, evaluate the polynomial x + x + 2 for small integer values of x. What is the longest string of
primes it yields, and for which values of x do they appear? Can you write a proof to explain your observations?
We here perform the operation for −3 ≤ x ≤ 10.
-3: (−3)2 + (−3) + 2 = 9 − 3 + 2 = 8 ⇒ 8 6= prime
-2: (−2)2 + (−2) + 2 = 4 − 2 + 2 = 4 ⇒ 4 6= prime
-1: (−1)2 + (−1) + 2 = 1 − 1 + 2 = 2 ⇒ 2 = prime
0: (0)2 + 0 + 2 = 0 + 0 + 2 = 2 ⇒ 2 = prime
1: (1)2 + 1 + 2 = 1 + 1 + 2 = 4 ⇒ 4 6= prime
2: (2)2 + 2 + 2 = 4 + 2 + 2 = 8 ⇒ 8 6= prime
3: (3)2 + 3 + 2 = 9 + 3 + 2 = 14 ⇒ 14 6= prime
4: (4)2 + 4 + 2 = 16 + 4 + 2 = 22 ⇒ 22 6= prime
5: (5)2 + 5 + 2 = 25 + 5 + 2 = 32 ⇒ 32 6= prime
6: (6)2 + 6 + 2 = 36 + 6 + 2 = 44 ⇒ 42 6= prime
7: (7)2 + 7 + 2 = 49 + 7 + 2 = 58 ⇒ 58 6= prime
8: (8)2 + 8 + 2 = 64 + 8 + 2 = 74 ⇒ 72 6= prime
9: (9)2 + 9 + 2 = 81 + 9 + 2 = 92 ⇒ 92 6= prime
10: (10)2 + 10 + 2 = 100 + 10 + 2 = 112 ⇒ 112 6= prime
Observe that for each integer, x2 + x + 2 is an even number, and is only prime when x = 0 and x = −1;
thus, we can theorize that the longest string of prime values generated by the equation is 2.
Proof. We can prove the claim by first showing that x2 + x + 2 is even for all x. Then, as 2 is the only even
prime number (by definition of prime and even numbers), we show that x2 +x+2 = 2 when x = 0 or x = −1.
Step 1: We show that ∀x ∈ Z, x2 + x + 2 is even.
First, let (x ∈ Z : x is even) be true. So 2|x, by definition of an even number. Thus there is some integer
y such that x = 2y. Observe that
x2 + x + 2 = (2y)2 + 2y + 2 = 4y 2 + 2y + 2 = 2(2y 2 + y + 1).
Observe that 2y 2 + y + 1 ∈ Z. Thus there is an integer z = 2y 2 + y + 1 such that x2 + x + 2 = 2z. Thus
2|(x2 + x + 2) and x2 + x + 2 is even.
5
Next, let (x ∈ Z : x is odd) be true. So, by definition of an odd number, there is an integer y such that
x = 2y + 1. Observe that
x2 + x + 2 = (2y + 1)2 + (2y + 1) + 2 = 4y 2 + 4y + 1 + 2y + 1 + 2 = 4y 2 + 6y + 4 = 2(2y 2 + 3y + 2).
Observe that 2y 2 + 3y + 2 is an integer. Thus there is an integer z = 2y 2 + 3y + 2 such that x2 + x + 2 = 2z.
Thus 2|(x2 + x + 2) and x2 + x + 2 is even.
Thus in all cases, x2 + x + 2 is even when x ∈ Z.
Step 2: We show that x2 + x + 2 = 2 when x = 0 or x = −1.
Let x2 + x + 2 = 2. So x2 + x = 0. Thus (x + 1)(x) = 0. So x + 1 = 0 or x = 0. Therefore x = −1 or
x = 0.
Step 3: We show that the longest string of prime numbers generated by x2 + x + 2 has length 2.
Recall from Step 1 that 2|(x2 + x + 2) for all x. Thus, x2 + x + 2 can only be prime when x2 + x + 2 = 2.
Recall from Step 2 that this only occurs when x = 0 or x = −1. Since these are the only values for which
x2 + x + 2 is prime, the longest (and only) string of prime numbers generated by x2 + x + 2 has length 2.
3.4. Question 12.
Sample 1
c Max String
x Values
3
1
1, 4, 7, 10, 19, 22, 25, 34, 37
5
3
1,2,3, 16,17,18
7
2
2,3, 8,9, 11,12, 17,18, 29,30, 32,33, 38,39
11
9
1,. . . ,9
17
15
1,. . . ,15
37
2
5,6, 8,9, 20,21, 29,30, 47,48
41
39
1,. . . ,39
Here, we see that c = 5, 11, 17, and 41 yielded results that mirror what we saw in the first experiment for
x2 + x + 41, but c = 7 and 37 were not able to produce more than 2 consecutive prime outputs. This supports the general hypothesis that the maximum number of consecutive inputs with prime outputs depends
on the third coefficient, but suggests that having a prime number as the third coefficient is not sufficient
for achieving the desired result. However, upon closer examination, it is apparent that the coefficients with
long (relative to their own magnitude) sequences of inputs producing prime outputs are all elements of
the set P1 , that is, they are congruent to 1mod4. On the other hand, note that 7 and 37 are congruent
to 3mod4 (and are elements of P3 ). This suggests that we achieve the results described for the first test
which used x2 +x+41 are achieved when the third coefficient is not only prime, but also congruent to 1mod4.
Sample 2
Modify your program to test various quadratic polynomials of the form x2 + x + q, for q = 2, 3, 5, 11, 17, 41
and 0 ≤ k ≤ 50. Create a table explaining your data. These values of q are specifically chosen; test q = 7, 37
to see what happens.
The modified program is thus:
1
2 def rulercheck(q,k):
3
primes=[]
4
for i in range(k):
5
x = i^2 + i + q
6
if is_prime(x):
7
primes.append(i)
8
return primes
Note that in this version, negative values of x are not used, so our 2-string of primes for q = 2 becomes a
single prime value.
q
length of longest string values of x that yield
of primes
string primes
2 1
x=0
3 2
0≤x≤1
5 4
0≤x≤3
7 2
Multiple strings
11 10
0≤x≤9
17 16
0 ≤ x ≤ 15
37 2
Multiple strings
41 40
0 ≤ x ≤ 39
Ignoring 7 and 37, one would think that an interesting pattern arises from these values; each prime p
produces a string of length p − 1 that runs from 0 to p − 2. However, examining other primes (such as 7
and 37), we see that this theory does not stand, as both 7 and 37 generate multiple instances of strings of
2, and nothing more (at least for k ≤ 50. This produces an interesting question: what primes will generate
the pattern?
3.5. Question 15.
Sample 1
6
1 (n) π3 (n)
Part 1. Create a table that displays π(n), π1 (n), π3 (n), ππ(n)
, π(n) for n = 25, 50, 100, 1000, 10000, 100000.
We created Sage programs that can calculate π(n), π1 (n), and π3 (n) to assist with the larger numbers.
1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
Calculate π(n):
def count_primes(k):
count=0
for i in range(k+1):
p = i
if is_prime(p):
count+=1
return count
Calculate π1 (n):
def count_primes1(k):
count=0
for i in range(k+1):
d = i
if d - 4*floor(d/4) == 1:
p = d
if is_prime(p):
count+=1
return count
Calculate π3 (n):
def count_primes3(k):
count=0
for i in range(k+1):
d = i
if d - 4*floor(d/4) == 3:
p = d
if is_prime(p):
count+=1
return count
With these programs under our belt, let’s create our table.
n
10
25
50
100
1000
10000
100000
π(n)
4
9
15
25
168
1229
9592
π1 (n)
1
3
6
11
80
609
4783
π3 (n)
2
5
8
13
87
619
4808
π1 (n)/π(n)
1/4
3/9
6/15
11/25
80/168
609/1229
4783/9592
π3 (n)/π(n)
2/4
5/9
8/15
13/25
87/168
619/1229
4808/9592
Part 2. What conjectures might you make on the basis of this evidence about the way the primes divide
themselves between these two progressions? Do your observations suggest that infinite number of primes lie
in each? Why?
Within these figures seem to lie two patterns that appear to be of great significance to the problem in
question. (These are merely conjectures: I have no method of proving either.)
Observation 1. limn→∞
π1 (n)
π(n)
= 21 .
Observation 2. π3 (n) ≥ π1 (n) for all n.
Sample 2
Now, we will look at the behaviour of the functions π1 (n) and π3 (n) by comparing them to πn in addition
to merely finding their values with the countprimes.m function. The results of this text can be seen in the
following table:
π1
π1
n
π(n) π1 (n) π3 (n)
π
π
10
4
1
2
0.25 0.50
25
9
3
5
0.33 0.56
50
15
6
8
0.40 0.53
100
25
11
13
0.44 0.52
1000
168
80
87
0.48 0.52
10000 1229 609
619 0.496 0.504
100000 9592 4783 4808 0.499 0.501
While the size of π3 (n) is still consistently larger than the size of π1 (n) for all of the chosen values of n,
1 (n)
the size difference appears to lose significance as n becomes larger. In fact, as n grows larger, the ratios piπ(n)
3 (n)
and ππ(n)
both appear to be approaching the value 0.5 as n increases. This suggests that the hypothesis
mentioned above, that the output of π3 (n) is larger than the output of π1 (n) is not obviously true, but also
does not prove it false. However, the apparent convergence of their ratios with π(n) suggests a different
7
result. If we consider the limit as n approaches infinity of π(n) to be the cardinality of the set P , then we
can think about these results in terms of the sets P1 and P3 .
3.6. Question 16.
Sample 1
First, recall from the very beginning of the essay that there are infinitely many primes. From this, we know
that the cardinality of P is infinite, and we can furthermore conclude that P is countably infinite because it
is a subset of a countable set, Z. From this, it seems logical to conclude that both the sets P1 and P3 have
infinitely many elements, or are countably infinite subsets of P . In fact, this conjecture can be proven as
follows:
Proof. Suppose for contradiction that there are only finitely many primes pn such that pn ≡ 3mod4.
Now, let M = 4p1 p2 . . . pn − 1 be 4 times the product of every prime pk ≡ 3 mod 4 minus 1.
Clearly, M is odd, and moreover there must be at least one odd integer which divides M , that is, M has
at least one odd prime factor.
Suppose that every odd prime factor of M is congruent to 1 mod 4. This implies that M ≡ 1 mod 4 as
well, since it is a product of primes congruent to 1 mod 4.
This creates a contradiction, as clearly M = 4p1 p2 . . . pn −1 is congruent to 3 mod 4 due to the subtraction
of 1 from a number congruent to 0 mod 4.
So, at least one prime factor of M must be congruent to 3 mod 4. However, there are only finitely many
primes congruent to 3 mod 4, so this factor must be pi for one of the pn in the assumption.
It also must be the case that pi |M and pi |p1 p2 . . . pn , which in turn implies that pi | − 1.
Clearly, this is a contradiction, so there must be infinitely many primes in P3 .
Additionally, that P3 is countably infinite follows directly from the fact that P is countable and P3 is a
subset of P .
To show the same result for P1 , there is a very similar proof. Note, however, that in the case of P1 we
must define M = 4(p1 p2 . . . pn )2 + 1 in order to follow the same steps as above and successfully arrive at
the contradiction pi |1. This extra square accounts for the possibility that a product of integers that are all
congruent to 3 mod 4 is not guaranteed to be itself congruent to 3 mod 4.
3.7. Question 21. Several slightly different games were considered.
Sample 1
Two players start with a single positive integer, which they may alternately subtract a prime number or one
from without making the number negative. Player ONE goes first, followed by Player TWO, and neither
may skip a turn. The last player to make a legal move wins. For example, if the starting number is 1,
Player ONE wins by subtracting 1 from it, leaving Player TWO no legal moves. If the starting number is 6,
Player ONE wins again by taking 2, leaving 4 for Player TWO. No matter what prime number or 1 Player 2
subtracts from 4, it is not possible to reach 0. Player 2 must leave Player ONE with a 1, 2, or 3, after which
Player ONE takes it and wins.
Working up from 0, the table on the next page is constructed, showing the winning strategy for the
player whose turn it is when the number on the left is present. A winning strategy is a series of contingent
moves such that no matter what series of moves the opponent makes, the player with the winning strategy
can force a win by making the right responses to those moves.
A good conjecture here is that if and only if the remaining number is not a multiple 4, the player whose turn
8
it is has a winning strategy, by taking 1, 2, or 3 from it to make it a multiple of 4 for the opponent.
Proof:
A player has the winning strategy by forcing the opponent to have a losing number. If the number is a
multiple of 4, then it is not possible to make it a multiple of 4 again in one take after subtracting a prime or
1, since neither is a multiple of 4. If the number is not a multiple of 4, the player whose turn it is keeps the
winning strategy by taking 1, 2, or 3, all allowable moves, to make it a multiple of 4. No matter what the
opponent’s response is, any prime must leave a number that is 1, 2 or 3 plus a multiple of 4. This allows the
winner player to eventually take the last number, leaving zero, since zero is a multiple of 4, and any starting
number is finite.
Sample 2
Define the prime number subtraction game and determine for which prime starting values each player has a
winning strategy. Give examples.
The Prime Number Subtraction Game is an altered version of the classic Subtraction Game.
Definition 1. Subtraction Game: A finite, two-player, win-lose, perfect information game in which two
players take turns subtracting elements from a predetermined set S ⊂ N from a predetermined starting
number N ∈ N, creating a new number greater than or equal to zero. The last player to make a legal move
wins.
Definition 2. Prime Number Subtraction Game: A special set of rules for the Subtraction Game, in
which the set S is equal to the set of prime numbers, plus the number one, and the number subtracted from
N must be less than N (in other words, the new number must be greater than or equal to one, rather than
zero).
Let’s reunite Fred and Charlie, our old game-playing friends, for a rousing round of Prime Number
Subtraction. They have a pile of 53 coins in front of them. Fred gets first move, and the game proceeds like
so:
Fred: 53 − 19 = 34
Charlie: 34 − 5 = 29
Fred: 29 − 13 = 16
Charlie: 16 − 3 = 13
Fred: 13 − 3 = 10
Charlie: 10 − 5 = 5
Fred: 5 − 3 = 2
Charlie: 2 − 1 = 1
Since Fred cannot make any more moves, Charlie is declared the winner. But did Charlie implement a
winning strategy? To answer this question, we must look backwards.
Let us define "N" positions as positions where the player who is next to move has the winning strategy,
and "P" positions as positions where the player who has just moved has the winning strategy. Since 1 is the
end goal of the game, 1 is a P-position - the player who has just moved has the winning strategy (they have
in fact won). 2 is an N-position, as the next player simply has to take 1 from 2 to get 1. Similarly, we can
label 3 and 4 as N-positions (the next player needs to take 2 or 3, respectively).
Observe, however, that 5 is a P-position, as 4 is not a prime number: the next player to move must take 1,
2 or 3, thus ensuring the victory of their opponent. Because 5 is a P-position, 6, 7 and 8 must be N-positions,
as the next player to move in these situations need only take 1,2, or 3, respectively, to create a P-position
for their opponent. 9 is another P-position, as 4 and 8 are both composite.
We now see a pattern emerging. When the remaining number R is equal to 1 + 4k for some k ∈ N - that
is, when R ≡ 1(mod 4) - the position R is a P-position. All others are N-positions, as taking either 1, 2, or
3, dependent on the situation, will result in a P-position.
Let us apply this to Fred and Charlie’s game. Note how 53 ≡ 1 (mod 4). Therefore, Fred and Charlie’s
game began in a P-position. Since Fred was the next player to move in this situation, Charlie had the
winning strategy. As we examine their game, we can see that Charlie did indeed apply the winning strategy,
leaving Fred in a P-position each turn.
3.8. Question 22.
Sample 1
A magic square is an arrangement of the numbers from 1 to n2 in an nxn matrix, a square matrix, with
each number occurring exactly once, and such that the sum of the entries of any row or any column is the
same. A true magic square has these properties with the inclusion of the sum of the entries of any main
diagonal is the same. The simplest magic square is a 1x1 matrix with only one entry.
A 2x2 magic square is not possible.
Proof. Consider the 2x2 magic square in figure 1:
A
C
B
D
Figure 1
9
If the sum of the rows and columns are equal in a magic square, then
A+B =A+C
and since A can be subtracted from both sides,
B=C
This contradicts that all entries of a magic square must be distinct integers.
Conjecture 3.1. There are infinitely many 3x3 magic squares that can be written using prime numbers.
From proof 1 we know that there are infinitely many prime numbers. We were able to find a 3x3 magic
square with the numbers:

1480028159
 1480028213
1480028141
1480028153
1480028171
1480028189

1480028201
1480028129 
1480028183
We would say that because there is a magic square with prime numbers this large and because there are
infinitely many prime numbers, there are infinetely many combinations of prime numbers that will make a
3x3 magic square.
Theorem 3. There exists at least one 4x4 magic squares using prime numbers.
We found the following 4x4 magic square using prime numbers:

53
 73

 103
47

37 89 97
101 61 41 

71 43 59 
67 83 79
Conjecture 3.2. There are infinitely many kxk magic squares
We were able to find a 3x3 and 4x4 magic square and also were abe to find through research a 5x5 (fig.
2) and even a 9x9 magic square using only prime numbers and because there are infinitely many prime
numbers, we say that there are infinitely many kxk magic squares using prime numbers.
19
89
131
83
211
191 227
43 11
199 113
47 151
53 31
73 23
139 251
59 31
191 61
71 167
Figure 2
Conjecture 3.3. We would say that there is no possible way to create a magic square using only Mersenne
Primes. A Mersenne Prime is a prime such that,
Mn = 2n − 1
consider:
Sample 2
Question 22:Are there infinitely many k for which there is a kxk magic square of primes? Also, Is there a
k for which there are infinitely many kxk magic squares of primes numbers?
A magic square of primes is a k − by − k arrangement of prime numbers such that every row, column, and
diagonal sum to the same constant. An example of a 3 − by − 3 magic square is:
41 89 83
113 71 29
59 53 101
There are two main methods to building a magic square, The Agrippe Diagonal Method and the Knights
Move Algorithm. For the purpose of creating prime magic squares the Knights Move Algorithm is what we
used. In the Knights Move Algorithm one chooses a starting place in the array, then puts the next number
in the meta sequence up one space, to the right two spaces, similar movement to a knight in a game of chess.
10
Definition 3.1. Meta-sequence A meta-sequence is a sequence composed of artithmatic sequences of equal
distance and length. The number of arithmetic sequences in a meta-sequence is equal to the number of
elements in each arithmetic sequence. M = {S0 , S1 , ..., Sk }, where Si = {si + 0d, si = 1d, ..., si + (k − 1)d}.
Notice that Si is a arithmetic sequence and si is an element of that arithmetic sequence. si is different for
each meta-sequence, but d is a constant for all of them.
Definition 3.2. Arithmetic Sequence A sequence of natural numbers of the form a + nd, where a and d are
fixed, and n is the cardinal position of the element in the sequence.
Knights Move Algorithm: for {n ≥ 2, z = 2 ∗ n + 1, 3/|z}, A meta-sequence M = {S0 , S1 , ..., Sz }.
(1) Begin at any square with i = j = 0.
(2) Place in the current square.
(3) Move two squares to the right, one square upwards.
(4) Increment j. If j < 2, go to step 2.
(5) Move two squares downward, one square to the left.
(6) Increment i. set j = 0. if i < z, go to step 2.
Notice, that this is not only for primes, but for all numbers. So now the question become, if this is out
building blocks for making magic squares, how do we know that there are arthmetic sequences of prime
numbers? So we now have a conjecture. There exists meta-sequences of cardinality k for finite k.
This conjecture is based off Dirichlets thoerem.
Theorem 4. If d ≥ 2 and a 6= 0 are integers that are relatively prime, then the arithmetic progression
a, a + d, a + 2d contains infinitely many primes.
The problem with this conjecture is that the numbers involved in the meta-sequence get to be gigantic.
Even with the computer capapbilities we have we would need an infinite amount of time to check every
prime. Assuming the conjecture is correct though, it means that it is possible to make magic squares of any
size kxk with the knights’ move method. Much of this was discovered and relayed through exploring the
The Book of Prime Number Records, by Paulo Ribenboim, please refer to this book as a source of great
information for all aspects of prime numbers.
4. Conclusion
Sample 1
To conclude, we have looked at various properties and results concerning prime numbers, which are formally
defined as integers p whose corresponding set of integers a such that a divides p has exactly two elements.
In simpler terms, prime numbers are integers which cannot be expressed as a product of more than two
primes, and those numbers which can be expressed as a product of multiple primes are called composite.
Then, we examined the possibility of generating prime numbers with polynomial functions, using MATLAB
to test some theories about the behaviour of these functions. We also divided the primes into three sets,
P1 , P2 , and P3 in order to closely examine the cardinality of these subsets, showing that, with the exception
of P2 , which is a trivial case with exactly 1 element, the set of all primes as well as the defined subsets are
countably infinite. In addition, we defined the prime-counting function π(n) and used it to examine finite
subsets of P . Lastly, we looked at a fun application of prime numbers to the Prime Subtraction Game in
order to find a winning strategy.
Looking toward the future, the next step in examining the prime numbers will be to run more numerical
tests and look for more patterns. Testing the given MATLAB functions with a larger variety of coefficients
will hopefully provide more insight into the role of the first and second coefficient in determining the longest
consecutive string of inputs which produce prime outputs. In addition to developing a more clear idea of how
the quadratic polynomial behaves in generating primes through experimentation, examining the behaviour
of higher-degree polynomials which fit the conditions laid out in the Bunyakovsky Conjecture will hopefully
produce more interesting insights into the behaviour of general polynomial functions which generate prime
numbers.
11