You are viewing a single comment's thread. Return to all comments →
import sys t = int(input().strip()) for a0 in range(t): m = int(input().strip()) prime = 0 while m % 2 == 0: prime = 2 m //= 2 n = 3 while n * n <= m: if m % n == 0: prime = n m //= n else: n += 2 if m > 2: prime = m print(prime)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #3: Largest prime factor
You are viewing a single comment's thread. Return to all comments →