Project Euler Solutions
Functions
python.p0087 Namespace Reference

Functions

def main ()
 

Detailed Description

Project Euler Problem 87

I ended up having to do this with recursion, which I normally do not like to
use that much. Small changes can have large effects on later results. Still,
this seems to work for the moment.

Revision 1:

Shorten the code slightly to take advantage of the primes() stop argument.
Probably loses performance slightly.

Problem:

The smallest number expressible as the sum of a prime square, prime cube, and
prime fourth power is 28. In fact, there are exactly four numbers below fifty
that can be expressed in such a way:

28 = 2**2 + 2**3 + 2**4
33 = 3**2 + 2**3 + 2**4
49 = 5**2 + 2**3 + 2**4
47 = 2**2 + 3**3 + 2**4

How many numbers below fifty million can be expressed as the sum of a prime
square, prime cube, and prime fourth power?

Function Documentation

def python.p0087.main (   int)