Skip to content

Instantly share code, notes, and snippets.

@jakedobkin
Created December 10, 2011 17:18
Show Gist options
  • Select an option

  • Save jakedobkin/1455632 to your computer and use it in GitHub Desktop.

Select an option

Save jakedobkin/1455632 to your computer and use it in GitHub Desktop.
Euler 48 Python: Exponential sum series
# http://projecteuler.net/problem=48.
n = 1000
sum = 0
for i in range (1,n+1):
sum += i**i
print str(sum)[-10:]
# python makes this trivial- but for a language that can't deal with large numbers,
# i think http://en.wikipedia.org/wiki/Exponentiating_by_squaring is probably how you'd do it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment