$2017$ is prime, and so is $(2017+1)/2=1009$.
$2017$ can be written as $a^2 + b^4$: $2017 = 44^2 + 3^4 = 1936 + 81$.
$2017 \equiv 2 \bmod 31$.
What is the next prime (if any) that satisfies these same three conditions?
$2017$ is prime, and so is $(2017+1)/2=1009$.
$2017$ can be written as $a^2 + b^4$: $2017 = 44^2 + 3^4 = 1936 + 81$.
$2017 \equiv 2 \bmod 31$.
What is the next prime (if any) that satisfies these same three conditions?
Actually, with a bit of modular arithmetic and patience, you can find a solution without code.
Looking $\mod 3$:
Note that neither $p$, nor $p+1$ can be divisible by 3. Hence $p \equiv 1 \mod 3$.
Looking $\mod 4$:
Squares and hence fourth powers are 0 or 1 mod 4, so their sum is 0, 1 or 2 mod 4.
Clearly only 1 mod 4 is possible, hence $p \equiv 1 \mod 4$.
Looking $\mod 5$:
Squares are 0, 1 or 4 mod 5, fourth powers 0 or 1 mod 5. Note that neither $p$, nor $p+1$ can be divisible by 5. This gives as the only possibilities that $p \equiv 1 \mod 5$ or $p \equiv 2 \mod 5$.
Looking $\mod 31$:
It is given that $p \equiv 2 \mod 31$.
Combining with Chinese remainder theorem:
$3 \cdot 4 \cdot 5 \cdot 31 = 1860$, so we need to look mod 1860. Note that $2017 \equiv 2 \mod 5$, so $p \equiv 2 \mod 5$ gives with the other congruences that $p \equiv 2017 \equiv 157 \mod 1860$. The other possibility gives $p \equiv 1 \mod 60$ and $p \equiv 2 \mod 31$. This gives $p \equiv 901 \mod 1860$.
Now, we have only a few possibilities left:
The most difficult thing is proving (by hand) that $p=11317$ and $p=5659$ are prime, but other than that, it is actually doable. I did use a number factorizer in the proces, to be honest, but the largest prime I used was 29, so it can be done by hand.
Alternatively, one could check every fourth power to see if $p$ can be written as $a^2+b^4$.
There are only 10 below $10^4=10000$, so that should also be doable.
I think the next number that satisfies these conditions is:
11317.
(1) It is prime and 11318 / 2 = 5659 is also prime.
(2) It can be written as 106² + 3⁴.
(3) It has a remainder of 2 when divided by 31.
172021 (414 | 5) (don't hold your breath waiting for that year! :D), 188017 (409 | 12), 367321 (605 | 6), 438001 (660 | 7), 489337 (651 | 16), 509797 (714 | 1), 560017 (321 | 26), 705097 (611 | 24), and 926437 (54 | 31).
[Brute-force search limited by a < 1000 and b < 50, so these next few are probably incomplete]
1434217 (621 | 32), 1501921 (36 | 35), 1746697 (259 | 36), 2007097 (819 | 34), 2085217 (9 | 38), 4901257 (651 | 46), and 4914277 (186 | 47).
– Ant Jan 01 '17 at 03:17