login
Numbers that are a sum of the cubes of three primes.
4

%I #23 Aug 09 2021 09:10:13

%S 24,43,62,81,141,160,179,258,277,359,375,378,397,476,495,593,694,713,

%T 811,1029,1347,1366,1385,1464,1483,1581,1682,1701,1799,2017,2213,2232,

%U 2251,2330,2349,2447,2548,2567,2665,2670,2689,2787,2883,3005,3536,3555

%N Numbers that are a sum of the cubes of three primes.

%C The subsequence of cubes in the sequence starts 505^3, 535^3, 709^3, 865^3, 1033^3, 1037^3, 1067^3, 1133^3, 1513^3, ... See A258262.

%H Reinhard Zumkeller, <a href="/A258865/b258865.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A030078(i)+A030078(j)+A030078(k) for some triple (i,j,k).

%F By a counting argument a(n) >> n log^3 n and hence the sequence is of density 0. - _Charles R Greathouse IV_, Aug 09 2021

%e 2^3+2^3+2^3=24. 2^3+2^3+3^3=43. 2^3+3^3+3^3=62. 3^3+3^3+3^3=81.

%p A258865 := proc(lim)

%p local a,p,q,r ;

%p a := {} ;

%p p := 2 ;

%p while p^3 < lim do

%p q := p ;

%p while p^3 +q^3< lim do

%p r := q ;

%p while p^3+q^3+r^3 <= lim do

%p a := a union {p^3+q^3+r^3} ;

%p r := nextprime(r) ;

%p end do:

%p q := nextprime(q) ;

%p end do:

%p p := nextprime(p) ;

%p end do ;

%p a ;

%p end proc:

%p A258865(30000) ;

%t lim = 15; Take[Sort@ DeleteDuplicates[Total /@ (Tuples[Prime@ Range@ lim, 3]^3)], 3 lim] (* _Michael De Vlieger_, Jun 12 2015 *)

%o (Haskell)

%o import Data.Set (singleton, deleteFindMin, fromList)

%o import qualified Data.Set as Set (union)

%o import qualified Data.List.Ordered as List (union)

%o a258865 n = a258865_list !! (n-1)

%o a258865_list = tail $ f (singleton 1) 1 [] [] a030078_list where

%o f s z vs qcs pcs'@(pc:pcs)

%o | m < z = m : f s' z vs qcs pcs'

%o | otherwise = f (Set.union s $ fromList $ map (+ pc) ws)

%o pc ws (pc:qcs) pcs

%o where ws = List.union vs $ map (+ pc) (pc : qcs)

%o (m, s') = deleteFindMin s

%o -- _Reinhard Zumkeller_, Jun 13 2015

%o (PARI) list(lim)=my(v=List(), P=apply(p->p^3,primes(sqrtnint(lim\=1,3)))); foreach(P,p, foreach(P,q, my(s=p+q,t); for(i=1,#P, t=s+P[i]; if(t>lim,break); listput(v,t)))); Set(v) \\ _Charles R Greathouse IV_, Aug 09 2021

%Y Cf. A138854, A114923.

%Y Cf. A030078, A258262 (subsequence).

%K nonn

%O 1,1

%A _R. J. Mathar_, Jun 12 2015