If this exam is like most of the others I've made up in my career, it's probably too long. I get carried away thinking of interesting questions. So do as much as you can in the allotted time. Turn in your paper. Then take the exam home and do it again as homework for Tuesday.
Reminder: in strings order matters and repetitions are allowed.
N = x2 - y2 .Hint: Remember that
x2 - y2 = (x-y)*(x+y).Then count how many ways are there to write N as a product of two factors.
Note. The Prime Number Theorem says (in one form) that the nth prime is about n*ln(n). The approximation isn't very good for small numbers: the 101st prime is 547, while 101 * ln(101) = 466.127172.
Here's a theorem we haven't proved (yet). Use it in what follows.
If p is prime and a !== 0 (mod p) then a has either no square roots (mod p) or exactly two.
Note: html isn't kind to mathematics. I'll write == for
the congruence symbol, and !== to negate a congruence.
For example, modulo 7,
1 == 12 == 62 (mod 7) 2 == 32 == 42 (mod 7) 4 == 22 == 52 (mod 7)so 1, 2 and 4 each have two square roots mod 7, while the equations
3 == x2 (mod 7) 5 == x2 (mod 7) 6 == x2 (mod 7)have no solutions, so 3, 5 and 6 have no square roots.
Suppose p is prime and a !== 0 (mod p). Then a(p-1)/2 == +-1 (mod p).
Suppose p is prime and a !== 0 (mod p). If a has a square root mod p then a(p-1)/2 == 1 (mod p).