Skip to content

Instantly share code, notes, and snippets.

@larrycai
Created October 13, 2011 02:04
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 larrycai/1283160 to your computer and use it in GitHub Desktop.
Save larrycai/1283160 to your computer and use it in GitHub Desktop.
http://projecteuler.net solutions in python
# solution from http://weibo.com/1937408130
total = sum([x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0])
print total
total = 0;
a,b = 0,1
while a<4000000:
a,b = b,a+b
if a %2 == 0:
print a;
total += a;
print total
arr=""
for n in range(900000):
arr = arr + str(n)
print int(arr[1]) * int(arr[10]) * int(arr[100]) * int(arr[1000]) * int(arr[100
0]) * int(arr[100000]) * int(arr[1000000])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment