50
f[1] = Prime[1];
f[n_] := f[n] = f[n - 1] + Prime[n];
i = 1;
While[f[i] < 1000000, i++];
maxIter = i - 1;
primeList = Table[Prime[i], {i, maxIter}]; i = 1; While[
Not[Or @@
PrimeQ[MovingAverage[primeList, maxIter - i]*(maxIter - i)]],
i = i + 1];
SelectFirst[
Reverse[MovingAverage[primeList, maxIter - i]*(maxIter - i)], PrimeQ]
#结果
997651