This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10以下の素数の和は 2 + 3 + 5 + 7 = 17 である. | |
200万以下の全ての素数の和を求めよ. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a^2 + b^2 = c^2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 | |
66896648950445244523161731856403098711121722383113 | |
62229893423380308135336276614282806444486645238749 | |
30358907296290491560440772390713810515859307960866 | |
70172427121883998797908792274921901699720888093776 | |
65727333001053367881220235421809751254540594752243 | |
52584907711670556013604839586446706324415722155397 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Problem7: | |
LIMIT = 10001 | |
PRIME = [] | |
def main(self): | |
i = 1 | |
while(len(self.PRIME) < self.LIMIT): | |
i = i + 1 | |
if self.isPrime(i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Problem6: | |
LIMIT = 100 | |
def main(self): | |
l = range(1, self.LIMIT + 1) | |
print((sum(l) ** 2) - (sum(i * i for i in l))) | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2520 は 1 から 10 の数字の全ての整数で割り切れる数字であり, そのような数字の中では最小の値である. | |
では, 1 から 20 までの整数全てで割り切れる数字の中で最小の正の数はいくらになるか. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Problem4: | |
def main(self): | |
palindromeNumber = 0 | |
for i in range(100, 1000): | |
for j in range(i, 1000): | |
num = i * j | |
if self.isPalindromeNumber(num): | |
if num > palindromeNumber: | |
palindromeNumber = num |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13195 の素因数は 5, 7, 13, 29 である. | |
600851475143 の素因数のうち最大のものを求めよ. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
フィボナッチ数列の項は前の2つの項の和である. 最初の2項を 1, 2 とすれば, 最初の10項は以下の通りである. | |
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
数列の項の値が400万以下の, 偶数値の項の総和を求めよ. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10未満の自然数のうち, 3 もしくは 5 の倍数になっているものは 3, 5, 6, 9 の4つがあり, これらの合計は 23 になる. | |
同じようにして, 1000 未満の 3 か 5 の倍数になっている数字の合計を求めよ. |