%I #12 Dec 16 2024 19:18:35
%S 2,7,503,113,7151,109873,162287,2251875110689,1423309560546093919,
%T 1831931738588396657,266306005917953213327,
%U 13573982207668041076860262513,4485809513902758532742979512207
%N a(n) is smallest prime not already in the sequence such that the sum of the first n terms is an n-th power.
%H Sean A. Irvine, <a href="/A073698/b073698.txt">Table of n, a(n) for n = 1..100</a>
%e Sum of two terms 2+7 = 9 = 3^2. Sum of three terms 2+7+503 = 512 = 8^3.
%t a[n_] := a[n]=Module[{sm, i}, sm=Sum[a[i], {i, 1, n-1}]; For[k=Ceiling[(sm+2)^(1/n)], !ProvablePrimeQ[k^n-sm]||MemberQ[a/@Range[n-1], k^n-sm], k++, Null]; k^n-sm] (* First do <<NumberTheory`PrimeQ` *)
%Y Cf. A093927, A093928, A093929, A093355.
%K nonn
%O 1,1
%A _Amarnath Murthy_, Aug 12 2002
%E Edited by _Dean Hickerson_, Dec 02 2002