Project Euler - 3
최대 소인수
600851475143의 소인수 중에서 최대 값을 구하라.
"""
Largest prime factor
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
class PrimeNumber:
def __init__(self):
self.current = 1
self.num_set = set()
def __iter__(self):
return self
def __next__(self):
self.current += 1
while True:
for i in self.num_set:
if self.current % i == 0:
self.current += 1
break # Break current for loop
else:
break # Break the while loop and return
self.num_set.add(self.current)
return self.current
if __name__ == '__main__':
number = 600851475143
prime_number = PrimeNumber()
for n in prime_number:
if n > number:
break
if number % n == 0:
print(n)
소수를 구하기 위해 Iterator를 구현하였다.
1xbet - No 1xbet Casino | Live dealer casino online
답글삭제1xbet is a reliable casino site that offers a great casino games ventureberg.com/ from the best software kadangpintar providers for the regulated gambling markets. Rating: 8/10 · Review by 1xbet korean a Tripadvisor user · herzamanindir.com/ Free · https://deccasino.com/review/merit-casino/ Sports