我们可以直接验证, 2019是所有可以用6种方式分解为三个素数平方和的最小正整数. Mathematica代码如下:
Solve[x Log[x] == 2019, x];
n = Floor[x /. %] // First
primes = Reap[For[k = 1, k <= n, k++, p = Prime[k];
If[p < Sqrt[2019], Sow[p]]]][[-1, 1]]
LenPrimes = Length[primes];
ClearAll[i, j, k]
For[y = 1, y <= 2019, y++, county = 0;
For[i = 1, i <= LenPrimes, i++, pi = primes[[i]];
For[j = i, j <= LenPrimes, j++, pj = primes[[j]];
For[k = j, k <= LenPrimes, k++, pk = primes[[k]];
If[pi^2 + pj^2 + pk^2 == y, county++;
Print[Superscript[pi, 2], "+", Superscript[pj, 2], "+",
Superscript[pk, 2], "=", pi^2 + pj^2 + pk^2]]
]
]
];
If[county != 0, Print[county]]
]
利用输出知
72 + 112 + 432 = 2019
72 + 172 + 412 = 2019
112 + 232 + 372 = 2019
132 + 132 + 412 = 2019
172 + 192 + 372 = 2019
232 + 232 + 312 = 2019