Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Last active August 31, 2015 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anirudhjayaraman/72f9d98fdd269e8da88d to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/72f9d98fdd269e8da88d to your computer and use it in GitHub Desktop.
Non Meaty Part of Project Euler Problem 12
# First Step
# First number 'check' to have 500 divisors
check = 2**4 * 3**4 * 5**4 * 7 * 11
# Second Step
# Starting from 'check', iterate sequentially checking for the next 'triangle' number
while not isTriangleNumber(check):
check += 1
# Third and Fourth Steps
# Calculate the last term of the series ('seriesLastTerm') that adds up to the newly calculated triangle number 'check'
seriesLastTerm = lastTerm(check)
# Iterate over triangle numbers checking for divisors > 500
while divisors(check) <= 500:
# add the next term to check to get the next triangle number
check += (seriesLastTerm + 1)
seriesLastTerm += 1
print check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment