For any positive integer $n$, define $s(n)$ as the smallest positive integer $m$ such that the $n$ distinct numbers $$ (p_1-1)^2,\ (p_2-1)^2,\ \ldots,\ (p_n-1)^2$$ are pairwise incongruent modulo $m$, where $p_k$ denotes the $k$-th prime. It is easy to check that $$s(1) = 1,\ s(2) = 2,\ s(4) = 9\ \text{and}\ s(9) = 25.$$
My recent computation on the values of $s(n)$ led me to formulate the following surprising conjecture.
Conjecture A. For any integer $n>2$ with $n\not=4,9$, we have $s(n)=p_{n+1}$.
This has been verified for $n\le55000$. The conjecture indicates that for every $n=10,11,\ldots$ we can compute the $(n+1)$-th prime $p_{n+1}$ in terms of the first $n$ primes $p_1,\ldots,p_n$. Thus I'd like to view the conjecture as a mysterious recurrence for primes.
Clearly $s(n) \le s(n+1)$ for any positive integer $n$. Note that $s(n)\not= p_k$ for every $k=1,\ldots,n$ since $$(p_k-1)^2 \equiv (p_1-1)^2 = 1\pmod{p_k}.$$ We also have $s(n) \le p_{n+1}$ since $ p_{n+1}$ does not divide $$(p_k-1)^2 - (p_j-1)^2 = (p_k-p_j)(p_k+p_j-2) $$ for any $1\le j<k\le n$. Note that if $p_{n+1}=p_k+p_j-2$ with $1\le j<k\le n$ then we must have $p_j=2$ (as $p_{n+1}$ is odd) and hence $p_k=p_{n+1}$ which is impossible.Thus, we have reduced the conjecture to the following one.
Conjecture B. For any composite number $m > 5$ with $m\not=9,25$, there are distinct primes $p$ and $q$ smaller than $m$ such that $$ (p-1)^2 - (q-1)^2 = (p-q)(p+q-2)\equiv0\pmod m.$$
If $m$ is a positive even number with $m+2 = p+q$ for some distinct primes $p$ and $q$, then $(p-1)^2\equiv (q-1)^2\pmod{m}$. Thus Conjecture B with $m$ even can be explained in the spirit of Goldbach's conjecture. However, I don't have any reasonable explanation for Conjecture B with $m$ odd.
For some related data, one may consult https://oeis.org/A387959 and https://oeis.org/A387947.
QUESTION. Are Conjectures A and B really correct? Any ideas to prove the mysterious recurrence in Conjecture A? Can one provide a reasonable explanation (even not rigorious) for Conjecture B in the case $2\nmid m$?
Your comments (including further check of the conjectural recurrence) are welcome!