# A mysterious connection between primes and squares

Motivated by two previous questions of mine (cf. Primes arising from permutations and Primes arising from permutations (II)), here I ask a curious question which connects primes with squares.

QUESTION: Is my following conjecture true?

Conjecture. Let $$n$$ be any positive integer, and let $$S(n)$$ denote the number of permutations $$\tau$$ of $$\{1,\ldots,n\}$$ with $$k^4+\tau(k)^4$$ prime for all $$k=1,\ldots,n$$. Then $$S(n)$$ is always a positive square.

Via a computer, I find that $$(S(1),\ldots,S(11))=(1,1,1,4,4,4,4,64,16,144,144).$$ For example, $$(1,3,2)$$ is a permutation of $$\{1,2,3\}$$ with $$1^4+1^4=2,\ \ 2^4+3^4=97,\ \ \text{and}\ 3^4+2^4=97$$ all prime.

• Any further check of this conjecture is welcome! By the way, it might be possible to prove that $S(n)$ is always a square. – Zhi-Wei Sun Nov 15 '18 at 5:09
• $(S(12),\dots,S(20))=(0,12^2,12^2,17^2,66^2,54^2,150^2,282^2,1374^2)$. I computed the permanent of the matrix $M$ where $M_{ij}$ is $1$ if $i^4+j^4$ is prime and $0$ otherwise. – MTyson Nov 15 '18 at 6:02
• Note that $M$ is symmetric and that all $1$'s are in entries where $i+j$ is odd, except for the $1$ in the upper left. Therefore by sorting rows and columns into the order $(1,3,5,\dots,2,4,6,\dots)$ it can be transformed into a block matrix $\begin{pmatrix}W&X\\X^\top& 0\end{pmatrix}$, where $W$ is $0$ except for a $1$ in the upper left entry. If it weren't for this $1$, we would have $\mathrm{perm}(M)=\mathrm{perm}(X)^2$. – MTyson Nov 15 '18 at 6:29
• @Nemo When $n$ is odd, $X$ is not even a square matrix... – Zach Teitler Nov 15 '18 at 11:17
• I think this conjecture was hasty and both @MTyson comments and Ilya Bogdanov's answer show the result has very little to do with primes. – Yaakov Baruch Nov 16 '18 at 9:45

If $$n$$ is odd, among the sums of the form $$i^4+\tau_i^4$$ there is an even one; it should equal to 2, hence $$\tau_1=1$$. All other odd numbers should map to even ones, and vice versa. Hence the number of permutations under the question is the square of the number of bijections from odds (from 3 to $$n$$) to evens satisfying the same constraint.
If $$n$$ is even, we cannot have $$\tau_1=1$$, otherwise there would be another even sum. Hence a similar reasoning applies.
It remains to show that there exists at least one such permutation.. (Notice that for the constraint on $$i+\tau_i$$ this would follow easily from the Bertrand postulate...)
• I believe it is still an open problem whether there are infinitely many primes of the form $a^4+b^4$. I can't provide a reference right now, but I have seen it claimed that a Friedlander-Iwaniec-type result regarding primes of the form $a^3+2b^3$ that this is the sparsest polynomial set which is known to contain infinitely many primes. – Wojowu Nov 15 '18 at 8:50
• There is no such permutation if $n=12$. @MTyson's comment above lists $S(12)=0$. (You don't need to check all $12!$ permutations. The numbers $12^4+1^4,12^4+3^4,12^4+5^4,\dotsc,12^4+11^4$ are all composite, that's sufficient.) – Zach Teitler Nov 15 '18 at 11:11