Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 27 lines (19 sloc) 0.389 kB
8b65f9e 5 more problems to 50
skate authored
1 import sys
2 from math import sqrt
3 start = 144
4
5 def is_tr(n):
6 if ((-1 + sqrt(8*n+1))%2 == 0):
7 return True
8 return False
9
10
11 def is_pent(n):
12 if ((sqrt(24*n+1)+1)%6 == 0):
13 return True
14 return False
15
16
17 def calc_hex(n):
18 return n*(2*n-1)
19
20 while(1):
21 val = calc_hex(start)
22 if is_tr(val) and is_pent(val):
23 print val
24 sys.exit(0)
25 start += 1
26
Something went wrong with that request. Please try again.