Consider the question: Given positive integers $a,b$, for what primes $p$ is $ap + b$ a perfect square? Denote the solution set by $P(a,b) = \{p \mid p \text{ is prime and } ap + b \text{ is a perfect square}\}$. We then see that $P(a,b)$ can be empty or finite but non-empty, and possibly infinite.
- If $b$ is a quadratic non-residue modulo $a$, then $P(a,b) = \varnothing$. We see this by reducing both sides of $ap + b = q^2$ modulo $a$.
- $P(1,1) = \{3\}$. It is easy to show $3$ is the only prime one less than a perfect square via the factoring $p = (q - 1)(q + 1)$.
- I suspect $P(2,2)$ and many others to be infinite, but I don't know how to prove it. This seems difficult in general, as I'm pretty sure showing $P(1,2)$ to be infinite is an open problem.
I was curious about the case of $|P(a,b)|$ being a positive integer. In particular, I am wondering what the possible values of $|P(a,b)|$ are when we know it to be a positive integer.
Question: For which positive integers $n$ do there exist positive integers $a$ and $b$ such that $|P(a,b)| = n$?
Here is some evidence that there are solutions $(a,b)$ for the first few positive integers:
- For $n = 1$: $P(1,1) = \{3\}$.
- For $n = 2$: $P(5,1) = \{3, 7\}$.
- For $n = 3$: $P(15,4) = \{3, 11, 19\}$.
- For $n = 4$: $P(48,25) = \{2, 3, 7, 17\}$.
- For $n = 5$: $P(168,25) = \{2, 3, 13, 37, 47\}$.
- For $n = 6$: $P(840,169) = \{2, 11, 19, 59, 197, 223\}$ (Peter and I both found this independently).
- For $n = 7$: $P(1680,121) = \{2, 7, 19, 29, 43, 409, 431\}$ (Credit: Peter).
- For $n = 8$: $P(17160,2209) = \{11, 29, 127, 181, 461, 1049, 4243, 4337\}$.
- For $n = 9$: $P(4444440, 529) = \{47, 101, 811, 1021, 22679, 44449, 123449, 277789, 1111087\}$ (Credit: Peter).
I do not write the proofs of these equations, since they all involve $b$ being a perfect square and taking the factoring of a difference of squares. Note that if $b$ is a perfect square, $P(a,b)$ is necessarily finite (but possibly empty) due to this factoring.
As I find likely solutions for greater $n$, I will update this post accordingly.