Euler Solution 48

From ProgSoc Wiki

Jump to: navigation, search

Solutions for Problem 48

Find the last ten digits of 11 + 22 + ... + 10001000

Lisp by SanguineV

Runtime (script mode): 198ms

(define (addNexptN n)
  (if (= n 1)
  1
  (+ (expt n n) (addNexptN (- n 1)))))

(begin (display (modulo (addNexptN 1000) 10000000000)) (newline))
(exit)

Python by Althalus

Runtime: 187 ms

total=0
for i in range (1,1001):total+=i**i
print(str(total)[-10:])
Personal tools