Project Euler Solutions
Functions
python.p0046 Namespace Reference

Functions

def main ()
 

Detailed Description

Project Euler Problem 46

Didn't even need to rearrange the formula to solve it trivially

Revision 1:

It turns out that rearranging the formula let me cut the time by ~50x

Problem:

It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a
square.

9 = 7 + 2×1^2
15 = 7 + 2×2^2
21 = 3 + 2×3^2
25 = 7 + 2×3^2
27 = 19 + 2×2^2
33 = 31 + 2×1^2

It turns out that the conjecture was false.

What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?

Function Documentation

def python.p0046.main (   int)