You are viewing a single comment's thread. Return to all comments →
import sys
import math
for _ in range(int(input())): x = int(input()) result = 1 for i in range(1, x + 1): result = result * i // math.gcd(result, i) print(result)
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 →
import sys
import math
for _ in range(int(input())): x = int(input()) result = 1 for i in range(1, x + 1): result = result * i // math.gcd(result, i) print(result)