Skip to content

Instantly share code, notes, and snippets.

@afrieirham
Created January 26, 2019 09:00
Show Gist options
  • Save afrieirham/c045f33c92f89fb35cd9a449b54b65b2 to your computer and use it in GitHub Desktop.
Save afrieirham/c045f33c92f89fb35cd9a449b54b65b2 to your computer and use it in GitHub Desktop.
Solution for Project Euler #6
def sumOfSqure(number):
total = 0
for i in range(1, number + 1):
total += i*i
return total
def squareOfSum(number):
total = 0
for i in range(1, number + 1):
total += i
total *= total
return total
def run(number):
print(squareOfSum(number) - sumOfSqure(number))
run(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment