Skip to content

Instantly share code, notes, and snippets.

@edalorzo
Created November 25, 2012 03:18
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 edalorzo/4142269 to your computer and use it in GitHub Desktop.
Save edalorzo/4142269 to your computer and use it in GitHub Desktop.
Project Euler-Problem #48
def next_number(stop=1000):
n = 1
while n <= stop:
yield n ** n
n += 1
if __name__ == '__main__':
result = str(sum(next_number()))[-10:]
print "The last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000 is: %s" % result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment