Returns the last 10 digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. >>> solution() '9110846700'
()
| 9 | |
| 10 | |
| 11 | def solution(): |
| 12 | """ |
| 13 | Returns the last 10 digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. |
| 14 | |
| 15 | >>> solution() |
| 16 | '9110846700' |
| 17 | """ |
| 18 | total = 0 |
| 19 | for i in range(1, 1001): |
| 20 | total += i**i |
| 21 | return str(total)[-10:] |
| 22 | |
| 23 | |
| 24 | if __name__ == "__main__": |