123456789101112131415161718192021 |
- #!/usr/bin/ruby
- # Author: Daniel "Trizen" Șuteu
- # License: GPLv3
- # Website: https://github.com/trizen
- # Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
- # https://projecteuler.net/problem=48
- # Runtime: 0.209s
- var mod = 10**10
- var sum = Mod(0, mod)
- for i in (1..1000) {
- sum += Mod(i, mod)**i
- }
- say sum.lift
|