OFFSET
1,1
COMMENTS
The primes p, q, and r are not necessarily distinct. - Jon E. Schoenfield, Sep 24 2018
LINKS
Project Euler, Problem 87: Prime power triples.
EXAMPLE
a(1) = 28 = 2^2 + 2^3 + 2^4 is the smallest sum of a prime squared, a prime cubed and the 4th power of a prime.
a(2) = 33 = 3^2 + 2^3 + 2^4 is the next number of that form.
MATHEMATICA
Take[Union[Total[#^{2, 3, 4}]&/@Tuples[Prime[Range[10]], 3]], 60] (* Harvey P. Dale, Mar 02 2013 *)
PROG
(PARI) is_p87(n, t, tt)=forprime(p=2, sqrtn(n, 4), t=n-p^4; forprime(q=2, sqrtn(t, 3), issquare(t-q^3, &tt) || next; isprime(tt) && return(1)))
print_p87(Nmax=999)=for(n=1, Nmax, is_p87(n) && print1(n", "))
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Jan 25 2008
STATUS
approved