Skip to content

Instantly share code, notes, and snippets.

@jakedobkin
Created December 8, 2011 21:38
Show Gist options
  • Select an option

  • Save jakedobkin/1448732 to your computer and use it in GitHub Desktop.

Select an option

Save jakedobkin/1448732 to your computer and use it in GitHub Desktop.
# let's start by making a set of all pentagonal numbers from to n=10000
# you can actually do to like n=4000 and get the same answer
# then let's say check every number in set vs. every other.
# if sum and difference is also in the set, compute the difference, print
h = set()
for i in range (1,10000):
pent = (i*(3*i-1))/2
h.add(pent)
min_d=0
for i in h:
for j in h:
if i+j in h:
if i-j in h:
print i,j,j-i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment