Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

The series, \1ドル^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317\$.

Find the last ten digits of the series, \1ドル^1 + 2^2 + 3^3 + \ldots + 1000^{1000}\$.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))

The series, \1ドル^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317\$.

Find the last ten digits of the series, \1ドル^1 + 2^2 + 3^3 + \ldots + 1000^{1000}\$.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))

The series, \1ドル^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317\$.

Find the last ten digits of the series, \1ドル^1 + 2^2 + 3^3 + \ldots + 1000^{1000}\$.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))
added 10 characters in body; edited tags
Source Link

The series, 1 ** 1 + 2 ** 2 + 3 ** 3 + ... + 10 ** 10 = 10405071317.

The series, \1ドル^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317\$.

Find the last ten digits of the series, 11 + 22 + 33 + ... + 1000 ** 1000.

Find the last ten digits of the series, \1ドル^1 + 2^2 + 3^3 + \ldots + 1000^{1000}\$.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))

The series, 1 ** 1 + 2 ** 2 + 3 ** 3 + ... + 10 ** 10 = 10405071317.

Find the last ten digits of the series, 11 + 22 + 33 + ... + 1000 ** 1000.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))

The series, \1ドル^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317\$.

Find the last ten digits of the series, \1ドル^1 + 2^2 + 3^3 + \ldots + 1000^{1000}\$.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))
Source Link
user203258
user203258

Project Euler # 48 Self powers in Python

The series, 1 ** 1 + 2 ** 2 + 3 ** 3 + ... + 10 ** 10 = 10405071317.

Find the last ten digits of the series, 11 + 22 + 33 + ... + 1000 ** 1000.

def self_power(n):
 """returns sum of self powers up to n."""
 total = 0
 for i in range(1, n + 1):
 total += i ** i
 return str(total)[-10:]
if __name__ == '__main__':
 print(self_power(1000))
lang-py

AltStyle によって変換されたページ (->オリジナル) /