Given a number n the task is to find the minimum number which is divisible by all numbers from 1 to n. Print the answer modulo (10^{9}+7).
 
Example 1:
Input:
n = 3
Output:
6 
Explanation:
When n = 3 then the minimum number
that is divisible by all the number
till 3 is 6.
Example 2:
Input:
n = 4
Output:
12
Explanation:
When n = 4 then the minimum number
that is divisible by all the number
till 4 is 12.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function numGame() which takes an Integer n as input and returns the answer.
 
Expected Time Complexity: O(n*log(n))
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= n <= 10^{5}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(n*log(n))
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

    def numGame(self, n):

        # code here 

Solutions:
import math

class Solution:

	def numGame(self, n):
		mid = 1000000007
		if n == 1:
			return n
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i // math.gcd(ans, i) % mid
		return ans


import math

class Solution:

	def lcm(self, a, b):
		if a % b != 0:
			return self.lcm(b, a % b)
		else:
			return b

	def numGame(self, n):
		ans = 1
		mid = 1000000007
		for i in range(1, n + 1):
			ans = int(int(ans * i) // self.lcm(ans, i) % mid)
		return ans


class Solution:

	def hcf(self, a, b):
		div1 = min(a, b)
		div2 = max(a, b)
		while div1 > 0:
			if div2 % div1 == 0:
				return div1
			else:
				k = div1
				div1 = div2 % div1
				div2 = k
		return div2

	def numGame(self, n):
		createdNum = 1
		for i in range(2, n + 1):
			h = self.hcf(createdNum, i)
			createdNum = createdNum * i // h % 1000000007
		return createdNum % 1000000007


class Solution:

	def numGame(self, n):
		from math import gcd
		if n < 2:
			return n
		mod = 1000000007
		res = 2
		for i in range(3, n + 1):
			if res % i:
				res = res * i // gcd(i, res) % mod
		return res


class Solution:

	def numGame(self, n):
		res = 1
		for i in range(2, n + 1):
			res = self.lcm(res, i)
			res %= 10 ** 9 + 7
		return res % (10 ** 9 + 7)

	def lcm(self, a, b):
		return a // self.gcd(a, b) * b

	def gcd(self, a, b):
		if a == 0:
			return b
		return self.gcd(b % a, a)


m = 1000000007

def gcf(a, b):
	if b == 0:
		return a
	return gcf(b, a % b)

def lcm(a, b):
	return a * b // gcf(a, b)

class Solution:

	def numGame(self, n):
		if n <= 2:
			return n
		LCM = 2
		for i in range(3, n + 1):
			LCM = lcm(LCM, i) % m
		return LCM


class Solution:

	def numGame(self, n):
		mod = int(1000000000.0 + 7)
		ans = 1
		for i in range(1, n + 1):
			ans = self.lcm(ans, i)
			ans = ans % mod
		return ans

	def lcm(self, a, b):
		return int(a * b / self.gcd(a, b))

	def gcd(self, a, b):
		if b == 0:
			return a
		return self.gcd(b, a % b)


class Solution:

	def HCF(self, a, b):
		if b == 0:
			return a
		return self.HCF(b, a % b)

	def LCM(self, a, b):
		return a * b // self.HCF(max(a, b), min(a, b))

	def numGame(self, n):
		ans = 1
		i = 2
		while i <= n:
			ans = self.LCM(i, ans)
			i += 1
			ans = ans % (10 ** 9 + 7)
		return ans


import math

class Solution:

	def numGame(self, n):
		mod = 10 ** 9 + 7
		if n == 1:
			return n
		res = 1
		for i in range(1, n + 1):
			res = res * i // math.gcd(res, i) % mod
		return res


class Solution:

	def numGame(self, n):

		def lcm(a, b):
			(x, y) = (a, b)
			while y:
				(x, y) = (y, x % y)
			return int(a * b / x % 1000000007)
		p = 1
		for i in range(2, n + 1):
			if p % i == 0:
				continue
			p = lcm(p, i)
		return p


class Solution:

	def numGame(self, n):

		def gcd(x, y):
			if y % x == 0 or x == 1:
				return x
			(x, y) = (y, x % y)
			return gcd(x, y)
		lcm = 1
		for i in range(1, n + 1):
			y = gcd(lcm, i)
			lcm = lcm / y * i % (10 ** 9 + 7)
		return int(lcm)


class Solution:

	def numGame(self, n):

		def gcd(a, b):
			r = a % b
			while r != 0:
				a = b
				b = r
				r = a % b
			return b

		def lcm(a, b):
			return a * b // gcd(a, b)
		if n == 1:
			return 1
		(l, m) = (lcm(1, 2), 10 ** 9 + 7)
		for i in range(3, n + 1):
			l = lcm(i, l) % m
		return l


class Solution:

	def gcd(self, a, b):
		if b == 0:
			return a
		else:
			return self.gcd(b, a % b)

	def numGame(self, n):
		if n < 3:
			return n
		lcm = 6
		for i in range(3, n + 1):
			lcm = lcm * i // self.gcd(lcm, i) % (10 ** 9 + 7)
		return lcm % (10 ** 9 + 7)


import math

class Solution:

	def numGame(self, n):
		m = 1000000007
		if n == 1:
			return n
		a = 1
		for i in range(1, n + 1):
			a = a * i // math.gcd(a, i) % m
		return a


import math

class Solution:

	def numGame(self, n):
		if n == 0:
			return 0
		if n == 1:
			return 1
		li = []
		mod = 10 ** 9 + 7
		for i in range(n):
			li.append(i + 1)
		for i in range(1, n):
			li[i] = li[i - 1] * li[i] // math.gcd(li[i - 1], li[i]) % mod
		return li[n - 1]


class Solution:

	def gcd(self, a, b):
		if b == 0:
			return a
		else:
			return self.gcd(b, a % b)

	def numGame(self, n):
		if n == 1:
			return 1
		res = 1
		for i in range(2, n + 1):
			hcf = self.gcd(i, res)
			res = res * i // hcf % 1000000007
		return res


from math import gcd

class Solution:

	def numGame(self, n):
		li = [int(x) for x in range(1, n + 1)]
		lcm = li[0]
		gc = li[0]
		for i in range(1, n):
			gc = gcd(lcm, li[i])
			lcm = lcm * li[i] // gc % (10 ** 9 + 7)
		return lcm


class Solution:

	def numGame(self, n):
		res = 1
		for i in range(1, n + 1):
			res = res * i // self.gcd(res, i) % 1000000007
		return res

	def gcd(self, res, i):
		while i:
			t = i
			i = res % i
			res = t
		return res


import math

class Solution:

	def numGame(self, n):
		max_prod = 1
		for i in range(1, n + 1):
			max_prod = int(max_prod * i / math.gcd(max_prod, i))
			max_prod = max_prod % 1000000007
		return max_prod


import math

class Solution:

	def numGame(self, n):
		m = 10 ** 9 + 7
		ans = 1
		for i in range(2, n + 1):
			ans = ans * i // math.gcd(ans, i) % m
		return ans


import math
import sys
sys.setrecursionlimit(1000000)

class Solution:
	global mod
	mod = 1000000007

	def numGame(self, n):

		def hcf(a, b):
			while True:
				rem = b % a
				if rem == 0:
					return a
				b = a
				a = rem
		ans = 1
		for i in range(2, n + 1):
			hc = hcf(ans, i)
			ans = ans * i // hc
			ans = ans % mod
		return ans


import math

class Solution:

	def numGame(self, n):
		result = 1
		if n == 1:
			return result
		for i in range(2, n + 1):
			result = result * i // math.gcd(result, i) % 1000000007
		return result


class Solution:

	def numGame(self, n):
		if n == 1:
			return 1
		if n == 2:
			return 2

		def getLCM(a, b):
			if a > b:
				num = a
				den = b
			else:
				num = b
				den = a
			rem = num % den
			while rem != 0:
				num = den
				den = rem
				rem = num % den
			hcf = int(den)
			lcm = int(int(a * b) / hcf)
			return lcm % 1000000007
		lcm = getLCM(1, 2)
		for i in range(3, n + 1):
			lcm = getLCM(i, lcm)
		return lcm % 1000000007


import math

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

class Solution:

	def numGame(self, n):
		modulo = 1000000007
		if n == 1:
			return n
		ans = 1
		for i in range(2, n + 1):
			ans = ans * i // gcd(ans, i) % modulo
		return ans


import math

class Solution:

	def numGame(self, n):
		s = 1000000007
		if n == 1:
			return n
		r = 1
		for i in range(1, n + 1):
			r = r * i // math.gcd(r, i) % s
		return r


class Solution:

	def grcd(self, n, i):
		if i == 0:
			return n
		return self.grcd(i, n % i)

	def numGame(self, n):
		m = 10 ** 9 + 7
		if n == 1:
			return n
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i // self.grcd(ans, i) % m
		return ans


class Solution:

	@classmethod
	def _gcd(cls, a, b):
		if b == 0:
			return a
		return cls._gcd(b, a % b)

	def numGame(self, n):
		mod = 10 ** 9 + 7
		lcm = 1
		for i in range(1, n + 1):
			lcm = lcm * i // Solution._gcd(i, lcm) % mod
		return lcm


def lcm(a, b):
	tempA = a
	tempB = b
	while b != 0:
		temp = a % b
		a = b
		b = temp
	return tempA * tempB // a % (10 ** 9 + 7)

class Solution:

	def numGame(self, n):
		ans = 1
		for i in range(2, n + 1):
			ans = lcm(ans, i)
		return ans


from math import *

class Solution:

	def numGame(self, n):
		if n == 1:
			return n
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i // gcd(ans, i) % (10 ** 9 + 7)
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.numGame(n))


import math

class Solution:

	def numGame(self, n):
		mid = 1000000007
		if n == 1:
			return n
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i // math.gcd(ans, i) % mid
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.numGame(n))


from math import *

class Solution:

	def numGame(self, n):
		a = 1
		for i in range(2, n + 1):
			b = a
			a = gcd(a, i)
			a = b * i // a % 1000000007
		return a
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.numGame(n))


class Solution:

	def GCD(self, a, b):
		if b == 0:
			return a
		while b != 0:
			r = a % b
			a = b
			b = r
		return a

	def numGame(self, n):
		if n == 1:
			return 1
		if n == 2:
			return 2
		mid = 1000000007
		lcm = 1
		for i in range(2, n + 1):
			gcd = self.GCD(lcm, i)
			lcm = lcm * i // gcd % mid
		return lcm
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.numGame(n))


class Solution:

	def gcd(self, divident, divisor):
		if divisor == 0:
			return divident
		return self.gcd(divisor, divident % divisor)

	def numGame(self, n):
		m = 10 ** 9 + 7
		if n < 3:
			return n
		res = 1
		for val in range(1, n + 1):
			res = res * val // self.gcd(res, val) % m
		return res


import math

class Solution:

	def numGame(self, n):
		total = 1
		M = 10 ** 9 + 7
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i // math.gcd(ans, i) % M
		return ans


class Solution:

	def numGame(self, n):
		m = 1000000007
		if n == 1 or n == 0:
			return n
		arr = [i for i in range(1, n + 1)]
		num1 = arr[0]
		num2 = arr[1]
		lcm = self.f_lcm(num1, num2, m)
		if len(arr) > 2:
			for i in range(2, len(arr)):
				lcm = self.f_lcm(lcm, arr[i], m)
		return lcm

	def f_lcm(self, num1, num2, m):
		if num1 > num2:
			num = num1
			d = num2
		else:
			num = num2
			d = num1
		rem = num % d
		while rem != 0:
			num = d
			d = rem
			rem = num % d
		gcd = d
		lcm = int(num1 % m * (num2 % m) / gcd % m)
		return lcm


import math

class Solution:

	def gcd(self, a, b):
		if b == 0:
			return b
		else:
			return math.gcd(b, a % b)

	def numGame(self, n):
		res = 1
		for i in range(2, n + 1):
			gc = self.gcd(res, i)
			res = res * i // gc % 1000000007
		return res


class Solution:

	def numGame(self, n):

		def hcf(m, n):
			if n == 0:
				return m
			else:
				return hcf(n, m % n)
		if n == 1:
			return 1
		(i, j, p) = (0, 0, 1)
		for i in range(2, n + 1):
			h = 1
			h = hcf(i, p)
			p = p * (i / h) % 1000000007
		return int(p)


class Solution:

	def gcd(self, a, b):
		while b:
			(a, b) = (b, a % b)
		return a

	def numGame(self, n):
		li = [i for i in range(1, n + 1)]
		lcm = li[0]
		for i in range(1, len(li)):
			hcf = self.gcd(lcm, li[i])
			lcm = lcm * li[i] // hcf % 1000000007
		return lcm


class Solution:

	def __init__(self):
		self.mod = 10 ** 9 + 7

	def gcd(self, a, b):
		if a == 0:
			return b
		return self.gcd(b % a, a)

	def numGame(self, n):
		res = 1
		for i in range(1, n + 1):
			if res % i == 0:
				continue
			gcd = self.gcd(res, i)
			non_gcd = i // gcd
			res = res * non_gcd % self.mod
		return res


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

class Solution:

	def numGame(self, n):
		res = 1
		for i in range(2, n + 1):
			res = res * i // gcd(res, i) % 1000000007
		return res


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

class Solution:

	def numGame(self, n):
		arr = []
		for i in range(1, n + 1):
			arr.append(i)
		pos = arr[0]
		for i in range(1, n):
			pos = lcm(pos, arr[i]) % 1000000007
		return pos


import math
from functools import reduce

class Solution:

	def gcd(self, a, b):
		m = 1000000007
		if a > b:
			num = a
			den = b
		else:
			num = b
			den = a
		rem = num % den
		while rem != 0:
			num = den
			den = rem
			rem = num % den
		lcm = a % m * (b % m) // int(den % m)
		return lcm % m

	def numGame(self, n):
		if n <= 1:
			return 1
		lis = [i for i in range(1, n + 1)]
		a = lis[0]
		b = lis[1]
		lcm = self.gcd(a, b)
		for i in range(2, n):
			lcm = self.gcd(lcm, lis[i])
		return lcm


class Solution:

	def numGame(self, n):
		if n == 1:
			return 1
		gcd = self.get_gcd(1, 2)
		lcm = 2 / gcd
		for b in range(3, n + 1):
			gcd = self.get_gcd(lcm, b)
			lcm = lcm * b / gcd % (10 ** 9 + 7)
		return int(lcm)

	def get_gcd(self, a, b):
		if b == 0:
			return a
		return self.get_gcd(b, a % b)


class Solution:

	def gcd(self, a, b):
		return a if b == 0 else self.gcd(b, a % b)

	def numGame(self, n):
		ret = 1
		for i in range(1, n + 1):
			ret = int(ret / self.gcd(ret, i)) * i % 1000000007
		return ret