You are viewing a single comment's thread. Return to all comments →
Python Solution, I cut some factor processing through prime checking
import math def isPrime(n): if n == 1: return False if n % 2 == 0: return False for i in range(3, int(math.sqrt(n))+1, 2): if n % i == 0: return False return True for t in range(int(input())): n = int(input()) s = n while True: if not isPrime(s): for i in range(2, n + 1): if s % i != 0: break else: print(s) break if s % 2 == 1: s += 1 else: s += 2
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #5: Smallest multiple
You are viewing a single comment's thread. Return to all comments →
Python Solution, I cut some factor processing through prime checking