login
Primes that are the sum of 5 distinct positive cubes.
3

%I #15 Aug 31 2023 15:44:37

%S 433,443,541,673,719,827,829,881,947,953,1171,1217,1223,1277,1289,

%T 1297,1559,1583,1609,1619,1709,1747,1801,1861,1871,1879,1889,1973,

%U 2003,2017,2081,2087,2131,2137,2141,2213,2221,2251,2269,2287,2297,2311,2339,2341,2393

%N Primes that are the sum of 5 distinct positive cubes.

%H Robert Israel, <a href="/A193141/b193141.txt">Table of n, a(n) for n = 1..10000</a>

%e 433=1^3+3^3+4^3+5^3+6^3, 443=1^3+2^3+3^3+4^3+7^3, 541=1^3+2^3+4^3+5^3+7^3.

%p N:= 3000: # for all terms <= N

%p S:= {}:

%p for a from 1 while 5*a^3 < N do

%p for b from a+1 while a^3 + 4*b^3 < N do

%p for c from b+1 while a^3 + b^3 + 3*c^3 < N do

%p for d from c+1 while a^3 + b^3 + c^3 + 2*d^3 < N do

%p S:= S union select(isprime,{seq(a^3 + b^3 + c^3 + d^3 + e^3, e=d+1..floor((N-a^3-b^3-c^3-d^3)^(1/3)))})

%p od od od od:

%p sort(convert(S,list)); # _Robert Israel_, Jun 21 2019

%t lst = {}; Do[Do[Do[Do[Do[p = a^3 + b^3 + c^3 + d^3 + e^3; If[PrimeQ[p], AppendTo[lst, p]], {e, d - 1, 1, -1}], {d, c - 1, 1, -1}], {c, b - 1, 1, -1}], {b, a - 1, 1, -1}], {a, 6, 20}]; Take[Union[lst], 80]

%t Module[{nn=15,upto},upto=nn^3+9;Select[Union[Total/@Subsets[Range[nn]^3,{5}]],PrimeQ[#] && #<=upto&]] (* _Harvey P. Dale_, Aug 31 2023 *)

%o (PARI) cbrt(x)=if(x<0,x,x^(1/3));

%o upto(lim)=my(v=List(), tb, tc, td, te); for(a=6, lim^(1/3), for(b=4, min(a-1, cbrt(lim-a^2)), tb=a^3+b^3; for(c=3, min(b-1, cbrt(lim-tb)), tc=tb+c^3; for(d=2, min(c-1, cbrt(lim-tc)), td=tc+d^3; forstep(e=1+td%2, d-1, 2, te=td+e^3; if(te>lim, break); if(isprime(te), listput(v, te))))))); vecsort(Vec(v), , 8)

%o \\ _Charles R Greathouse IV_, Jul 17 2011

%Y Cf. A122729, A193142, A193143.

%K nonn

%O 1,1

%A _Vladimir Joseph Stephan Orlovsky_, Jul 16 2011