Created
May 19, 2011 10:07
-
-
Save jarvist/980497 to your computer and use it in GitHub Desktop.
Calculate Additions of Non Repeating Triangular numbers:
This file contains 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
tn=1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 0, 0 | |
soln={} | |
for i in tn[:]: | |
for j in tn[tn.index(i)+1:]: | |
for k in tn[tn.index(j)+1:]: | |
for l in tn[tn.index(k)+1:]: | |
print i,j,k,l | |
soln[i+j+k+l]=i,j,k,l | |
print soln | |
print "I can't form the following integars below 100: " | |
for i in range(100): | |
if i not in soln: | |
print i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment