Created
December 8, 2011 21:38
-
-
Save jakedobkin/1448732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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