Skip to content
Snippets Groups Projects
Commit df4f5041 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Solved 44

parent 46d4581a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from math import sqrt
from sys import exit
def P(n):
return n * (3 * n - 1) / 2
def is_pent(n):
return ((1 + sqrt(24 * n + 1)) / 6.).is_integer()
for k in xrange(2, 10000):
Pk = P(k)
for j in range(k - 1, 0, -1):
Pj = P(j)
D = Pk - Pj
if is_pent(D) and is_pent(Pk + Pj):
print D
exit()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment