Solution:
First, we show that no other n work. If there does exist prime p≡3 (mod 4) such that νp(n)=1, then p∣abc; without loss of generality, assume p divides a. Then, p2∣a2 and p∣a2+b2+c2, so p∣b2+c2. Since p is 3 modulo 4, −1 is not a quadratic residue modulo p, so b2≡−c2 (mod p) only has the trivial solution (b,c)=0. Therefore p∣b and p∣c, so p2∣n. This contradicts νp(n)=1, so no solutions outside of the claimed solution set exist.
Now, we give the construction. Let n be in the claimed solution set. We proceed in two steps.
Step 1 (Local step). For each prime p dividing n, we will construct a,b, and c modulo pνp(n)+1 such that νp(gcd(a2+b2+c2,abc))=νp(n).
We have a couple cases.
- If νp(n)=2k for some positive integer k, pick a=pk, b=pk, and c=pk+1 for p=2 and pick a=b=c=pk for p=2.
- If p≡3 (mod 4) and νp(n)=2k+1 for some nonnegative integer k, then by Fermat's Christmas theorem, there are positive integers x and y for which x2+y2=p. Then pick a=xpk, b=ypk, and c=pk+1.
- If p≡3 (mod 4) and νp(n)=2k+1 for some nonnegative integer k, then k≥1 by assumption. We let x and y be positive integers for which νp(x2+y2+1)=1. (This is fairly standard. To briefly recall the proof, note that x and y satisfying x2+1≡−y2 (mod p) exist because some quadratic residue must be adjacent to a nonquadratic residue, and forcing x2+1≡−y2 (mod p2) can be done by adding appropriate multiples of p to x or y.) Then, pick a=xpk, b=ypk, and c=pk.
Step 2 (Global step). Given solutions (ap,bp,cp) modulo pνp(n)+1 for each prime p∣n, we construct a working solution (a,b,c) over positive integers.
By Chinese Remainder Theorem, we can pick positive integers a,b, and c such that for all prime p∣n, (a,b,c)≡(ap,bp,cp)(modpνp(n)+1). Now, we need to modify this construction to ensure that no other primes divide gcd(a2+b2+c2,abc).
For every prime p∣c with p∤n, we modify a and b (by adding additional congruence relations) so that p does not divide a2+b2. Then, p does not divide gcd(a2+b2+c2,abc) for any prime p such that p∣c and p∤n. Let
N=p∣cn∏pνp(n)+1,
S={primes p such that p∣ab but p∤cn},
P=p∈S∏pφ(N)≡1(modN).
In particular, we have only fixed residues of a,b,c modulo N at this point. Now, let a1=aP and b1=bP. This keeps all of our mod N conditions. We now claim that (a1,b1,c) works. To prove this, fix a prime p, and note that
if p divides cn, then since a′≡a (mod N) and b′≡b (mod N), we have νp(gcd(a12+b12+c2,a1b1c))=νp(n) from our construction of (a,b,c).
if p∈S, then we note that p divides a12+b12, but not c2, so p does not divide a12+b12+c2.
if p∈/S and p∤cn, then p does not divide a1b1c.
This concludes the proof.