Skip to content

Instantly share code, notes, and snippets.

@eeeady
Created March 21, 2014 20:59
Show Gist options
  • Select an option

  • Save eeeady/9696378 to your computer and use it in GitHub Desktop.

Select an option

Save eeeady/9696378 to your computer and use it in GitHub Desktop.
Project Euler Practice - Problem 1 (python)
#!/usr/bin/python
# project euler problem 1
#all the natural numbers below 10 are multiples of 3 or 5
# 3,5,6,9 their sum is 23
# find the sum of all the multiples of 3 or 5 below 1000
limit = 1000
def main():
summandr = []
lim3 = 1 + limit / 3
lim5 = limit / 5
for i in range(1, lim3):
summandr.append( i * 3 )
for i in range(1,lim5):
summandr.append( i * 5)
summandr = set(summandr)
print sum(summandr)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment