# Another puzzle on the properties of the prime 2017

$2017$ is the first prime that satisfies the following three conditions:

1. $p$ can be written as $a^2+21b^2$ for integers $a,b$; in this case, $2017=41^2+21\cdot 4^2$.

2. $p$ can be written as $c^2+24d^2$ for integers $c,d$; in this case, $2017=29^2+24\cdot 7^2$.

3. $p$ satisfies the following modular congruence: $p \equiv 3 \mod 53$.

What is the second such prime?

The puzzle can be solved without the use of computers. There is one exception: if you suspect a number to be prime, then you can check that using a computer. However, in your final answer, you shouldn't use the prime number checker more than once.

A simple calculator is allowed, but not necessary to solve the problem; all calculations that have to be made, are relatively easy. If it is necessary to make a lot of calculations for your solution, try to find something clever that avoids these calculations. Good luck!

Strongly inspired by 2017 is the 1st prime satisfying three conditions. What is the 2nd?.

4561

Explanation:

Look at equation 2 modulo 3. A square is either 0 or 1 modulo 3, so $p$ is 0 or 1 modulo 3, but 0 would imply $p$ is divisible by 3 which isn't possible. So $p \equiv 1 \pmod 3$.
Looking at the same equation modulo 8, knowing that squares are either 0, 1 or 4 modulo 8, and that 0 and 4 aren't possible for primes, we see that $p \equiv 1 \pmod 8$.
Modulo 7, squares are 0, 1, 2 or 4, so equation 1 implies that $p \equiv 1,2,4 \pmod 7$ as 0 is again not possible.
Combining the information about modulo 7 and 8, we see that modulo 56, $p$ must be equal to 1, 9 or 25.
Combining that with equation 3, we conclude that modulo 2968, $p$ must be equal to 1593, 2017 or 2865.
2865 is obviously not a prime. The next candidate, 1593 + 2968 = 4561 does the job; it's a prime.
We still need to check that it satisfies equations 1 and 2; knowing the value of 4561 modulo 3, 7 and 8 we can limit the number of possible values for a and c. It turns out that $4561 = 65^2 + 21 \cdot 4^2$ and $4561 = 55^2 + 24 \cdot 8^2$.

• Well done, this is the correct answer. There is one point where you could've done it a little shorter – to calculate that $p$ must be equal to one of the three numbers mod the fourth number might have been a little painful. If you initially leave out the mod 7 condition, instead of the mod 3 condition (which you didn't even use in this answer), there is only one possibility mod $24\cdot 53=1272$ which you know because 2017 is in it. – wythagoras Jan 1 '17 at 19:40
• Yeah, that would've been easier indeed. – Glorfindel Jan 1 '17 at 19:42