Problem:
 Score : 300 points    Problem Statement You are given an integer N .
Find the number of the positive divisors of N! , modulo 10^9+7 .      Constraints  1≤N≤10^3         Input The input is given from Standard Input in the following format:  N       Output Print the number of the positive divisors of N! , modulo 10^9+7 .        Sample Input 1 3      Sample Output 1 4  There are four divisors of 3!  =6 : 1 , 2 , 3 and 6 . Thus, the output should be 4 .       Sample Input 2 6      Sample Output 2 30       Sample Input 3 1000      Sample Output 3 972926972

Solution (Python):
import math

n=int(input())
num=[2,3]
for j in range(4,1000):
  for i in range(2,int(math.sqrt(j)+1)):
    if j%i==0:
      break
  else:
    num.append(j)

l=len(num)
times=[]
for ii in range(l):
  if num[ii]>n:
    break
  else:
    for jj in range(11):
      max=0
      count=0
      if num[ii]**jj>n:
        max=jj
    for k in range(1,max):
      count+=n//num[ii]**k
    times.append(count)
ans=1

for kk in range(len(times)):
  ans*=times[kk]+1
print(ans%1000000007)

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) 




from collections import Counter



N = int(input())
table = []

def factorint(N):
    
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    table.append(i)
                break
    return table

for i in range(1,N+1):
    factorint(i)
table_ = Counter(table)

ans = 1
for key in table_.keys():
    ans = ans * (table_[key]+1) % mod

print(ans)

Solution (Python):
MOD = 10**9 + 7
N = int(input())

import numpy as np
is_prime = np.ones(1001,dtype=np.bool)
is_prime[:2] = 0
for p in range(2,100):
  is_prime[p*p::p] = 0
primes = is_prime.nonzero()[0]

def fact_ord(p,n):
  if n < p:
    return 0
  return fact_ord(p,n//p) + n//p

answer = 1
for p in primes:
  answer *= (fact_ord(p,N)+1)
  answer %= MOD
  
print(answer)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
prime = []
d = [v for v in range(2, N + 1)]
while len(d) > 0:
    p = d[0]
    prime.append(p)

    d = [v for v in d if v % p != 0]
    
def f(n):
    c = 0
    mm = {}
    while n != 1:
        t = prime[c]
        if n % t == 0:
            if mm.get(t) == None:
                mm[t] = 0
            mm[t] += 1
            n = n // t
        else:
            c += 1
    return mm

m = {}
for i in range(2, N + 1):
    t = f(i)
    for k, v in t.items():
        if m.get(k) == None:
            m[k] = 0
        m[k] += v

ans = 1
for v in m.values():
    ans = ans * (v + 1) % (10 ** 9 + 7)
    
print(ans)

Solution (Python):
N = int(input())
t = [0] * (N + 1)

for i in range(2, N + 1):
    x = i
    p = 2
    
    
    while x > 1:
        while x % p == 0:
            t[p] += 1
            x //= p
        p += 1
        
ans = 1
for c in t:
    ans = (ans * (c + 1)) % (10 ** 9 + 7)
print(ans)

Solution (Python):
n = int(input())

primes = [True for i in range(n+1)]
nums = [1 for i in range(n + 1)]
for i in range(2, n + 1):
    if not primes[i]:
        continue
    for j in range(i * 2, n + 1, i):
        primes[j] = False
    x = i
    while x <= n:
        nums[i] += n//x
        x *= i

from functools import reduce
print(reduce(lambda x, y: x*y,nums)%(10**9+7))

Solution (Python):
N = int(input())

se = [0,0,1]+[1]*998
n = 2
while n ** 2 <= 1000:
    if se[n]:
        nn = 2*n
        while nn <= 1000:
            se[nn] = 0
            nn += n
    n += 1

prime = [x for x in range(0,1001) if se[x]]

ans = 1

for p in prime:
    nn = N
    d = 0
    while True:
        nn //= p
        if not(nn):
            break
        d += nn
    ans *= (d+1)

print(ans%(10**9+7))

Solution (Python):
import math
import copy

def trial_division(n):
    check = 0
    
    factor = []
    
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp+1):
        while n % num == 0:
            n /= num
            factor.append(num)
            check = 1
    
    if check == 0:
        factor.append(n)
    return factor

n = int(input())
ans = 1

div = []
for i in range(2,n+1):
    for j in trial_division(i):
        div.append(j)
        div = list(set(div))

for i in div:
    x = 0
    for j in range(i,n+1):
        num = j
        while num % i == 0:
            x += 1
            num /= i
    ans = (ans*(x+1))%(10**9+7)

print(ans)

Solution (Python):
import math
import copy

def trial_division(n):
    check = 0
    
    factor = []
    
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp+1):
        while n % num == 0:
            n /= num
            factor.append(num)
            check = 1
    
    if check == 0:
        factor.append(n)
    return factor

n = int(input())
ans = 1

div = []
for i in range(2,n+1):
    for j in trial_division(i):
        div.append(j)
        div = list(set(div))

for i in div:
    x = 0
    for j in range(i,n+1):
        num = j
        while num % i == 0:
            x += 1
            num /= i
    ans = (ans*(x+1))%(10**9+7)

print(ans)

Solution (Python):
from collections import defaultdict

d = defaultdict(int)

def trial_division(n):
    
    tmp = int(n ** 0.5) + 1
    for num in range(2, tmp):
        while n % num == 0:
            d[num] += 1
            n //= num
    if n > 1:
        d[n] += 1

    return

N = int(input())

for i in range(1, N+1):
    trial_division(i)

ans = 1
for k, v in d.items():
    ans *= v + 1
    
print(ans % (10 ** 9 + 7))

Solution (Python):
from collections import defaultdict


def factors(n):
    ps = []
    for i in range(2, int(n**0.5) + 1):
        while n % i == 0:
            n //= i
            ps.append(i)

    if n != 1:
        ps.append(n)

    return ps


d = defaultdict(lambda: 0)
n = int(input())
for i in range(2, n+1):
    fs = factors(i)
    for f in fs:
        d[f] += 1


c = 1
for _, v in d.items():
    c = c * (v + 1) % 1000000007

print(c)

Solution (Python):

import collections
import math
import sys

BIGINT = 1000000007
N = int(input())
counts = collections.defaultdict(int)

for n in range(2, N+1):
    for d in range(2, int(math.sqrt(n)) + 1):
        while n % d == 0:
            n = n // d
            counts[d] += 1
    if n > 1:
        counts[n] += 1



res = 1
for v in counts.values():
    res = (res * (v + 1) % BIGINT)

print(res)

Solution (Python):
def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  for i in range(2,int(n**0.5)+1):
    if n%i==0:
      return False
  else:
    return True

n=int(input())
primes=[]
for i in range(1,n+1):
  if prime(i):
    primes.append(i)
arr=[0]*(n+1)
for i in range(1,n+1):
  for j in primes:
    if j>i:
      break
    if i%j==0:
      arr[j]+=1
      i=i//j
      while i>1:
        if i%j==0:
          arr[j]+=1
          i=i//j
        else:
          break
ans=1
for i in primes:
  ans=(ans*(arr[i]+1))%(10**9+7)
print(ans%(10**9+7))

Solution (Python):
def prime(x):
    y = list(range(1, x + 1))
    y[0] = 0
    x_sqrt = x ** 0.5
    for i in y:
        if i > x_sqrt:
            break
        elif i == 0:
            continue
        for not_prime in range(2 * i, x + 1, i):
            y[not_prime - 1] = 0
    return [i for i in y if i > 0]

n = int(input())
MOD = 10 ** 9 + 7
primes = prime(n)
m = [0 for _ in range(len(primes))]
for i, p in enumerate(primes):
    for j in range(1, n + 1):
        while(j % p == 0):
            m[i] += 1
            j = j // p
ans = 1
for i in m:
    ans *= (i + 1)
    ans = ans % MOD
print(ans)

Solution (Python):
import math
k=int(input())
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

pl=primes(k)
ans=[]
m=math.factorial(k)
for i in range(len(pl)):
    tmp=0
    while m%pl[i]==0:
        m=m//pl[i]
        tmp+=1
    ans.append(tmp)
a=1
for i in range(len(ans)):
    a=a*(ans[i]+1)%(10**9+7)
print(a)

Solution (Python):
N = int(input())

MOD = 10 ** 9 + 7

d = dict()

for i in range(2, N+1):
    for j in d.keys():
        while i % j == 0:
            i //= j
            d[j] += 1
    if i != 1:
        d[i] = 1

ans = 1
for i in d.values():
    ans *= (i+1)
    ans %= MOD

print(ans)

Solution (Python):
n=int(input())
p=[2]
for i in range(3,n+1,2):
    for j in range(3,int(i**0.5)+1,2):
        if i%j==0:break
    else:p.append(i)
l=[0]*len(p)
for i in range(1,n+1):
    while i!=1:
        for j,k in enumerate(p):
            if i%k==0:
                l[j]+=1
                i//=k
ans=1
for i in l:ans=ans*(i+1)%(10**9+7)
print(ans)

Solution (Python):
N=int(input())
pList={}
mod = 10**9+7
def soinsuu(x):
    if x==1:return
    for p in pList:
        if x%p==0:
            pList[p] += 1
            return soinsuu(x//p)
    pList[x] = pList.get(x,0)+1
    return
for n in range(2,N+1):
    soinsuu(n)
ans = 1
for i in pList.values():
    ans = (ans*(i+1))%mod
print(ans)

Solution (Python):
from collections import defaultdict

N = int(input())

power = defaultdict(int)
for k in range(2, N + 1):
    _k = k
    for p in range(2, k + 1):
        while _k % p == 0:
            power[p] += 1
            _k //= p
ans = 1
for n in power.values():
    ans *= n + 1
print(ans % (10 ** 9 + 7))

Solution (Python):


import math

def solve(N):
    F = math.factorial(N)
    ans = 1
    
    for i in range(2, N + 1):
        count = 1
        while(F%i == 0):
            F //= i
            count += 1
        ans *= count
        
    print(ans % (10**9+7))

if __name__ == '__main__':
    N = int(input())
    
    solve(N)

Solution (Python):
N = int(input())

prime_dict = {}




while N > 1:
  pn = 2
  tmp = N
  while pn * pn <= tmp:
    while tmp % pn == 0:
      tmp = tmp / pn
      prime_dict[pn] = prime_dict.get(pn, 0) + 1
    pn += 1
  if tmp > 1:
    prime_dict[tmp] = prime_dict.get(tmp, 0) + 1
  N -= 1

cnt = 1  
for key in prime_dict.keys():
  cnt *= prime_dict[key]+1
  
print(cnt % (10**9+7))

Solution (Python):
N = int(input())

prime_dict = {}

while N > 1:
  pn = 2
  tmp = N
  while pn * pn <= tmp:
    while tmp % pn == 0:
      tmp = tmp / pn
      prime_dict[pn] = prime_dict.get(pn, 0) + 1
    pn += 1
  if tmp > 1:
    prime_dict[tmp] = prime_dict.get(tmp, 0) + 1
  N -= 1

cnt = 1  
for key in prime_dict.keys():
  cnt *= prime_dict[key]+1
  
print(cnt % (10**9+7))

Solution (Python):
import math
N = int(input())
F = math.factorial(N)
ans = 1
for i in range(2, N + 1):
    cnt = 1
    while F % i == 0:
        F //= i
        cnt += 1
    ans *= cnt
print(ans % (10 ** 9 + 7))

Solution (Python):
from math import factorial

N = int(input())

F = factorial(N)
result = 1
for i in range(2, N + 1):
    count = 1
    while F % i == 0:
        F //= i
        count += 1
    result *= count

print(result % (10 ** 9 + 7))

Solution (Python):
from collections import defaultdict, Counter

N = int(input())

memo = []
for n in range(2, N + 1):
    k = 2
    while k * k <= n:
        count = 0
        while n % k == 0:
            n //= k
            memo.append(k)
        k += 1
    if n > 1:
        memo.append(n)

MOD = 10 ** 9 + 7
result = 1
for n in Counter(memo).values():
    result = (result * (n + 1)) % MOD
print(result)

Solution (Python):

import math

def func(val):
    d = range(2, val+1)
    ans = []

    for i in range(2, val+1):
        if i in d:
            ans.append(i)
            d = [n for n in d if n % i != 0]
    
    return ans

n = int(input())

p = 1
pn_list = {}
for l in range(2, n+1):
    for pn in func(l):
        m = 0
        while(1):
            if l % pn != 0:
                break
            else:
                l /= pn
                m += 1
        
        pn_list.setdefault(pn, 0)
        pn_list[pn] += m

p = 1
for v in pn_list.values():
    p *= (v+1)

ans = p % (10**9 + 7)

print(ans)

Solution (Python):
N = int(input())
K = eval("*".join(map(str, list(range(1, N+1)))))
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)
print(ans % (10**9 + 7))

Solution (Python):
def get_primes(n):
	primes = [True for i in range(n+1)]
	primes[0] = False
	primes[1] = False
	for i in range(2, n+1):
		if i*i > n:
			break
		if not primes[i]:
			continue
		for non_prime in range(2 * i, n+1, i):
			primes[non_prime] = False
	return [i for i, prime in enumerate(primes) if prime]


def main():
	N = int(input())
	ans = 1
	DIV = 10**9+7
	primes = get_primes(N)
	d = [1]*len(primes)

	for i, p in enumerate(primes):
		q = p
		while N >= q:
			d[i] += N//q
			q *= p

	for div_num in d:
		ans *= div_num
		ans %= DIV
	print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def is_prime(n):
    if n == 2:
        return True
    else:
        for i in range(2, int((n**(1/2)))+1):
            if n % i == 0:
                return False
        return n > 1

from collections import Counter
N = int(input())
MOD = 10**9+7

primes = [i for i in range(N+1) if is_prime(i)] 

c = Counter(primes) 
                    
                    


for j in range(2, N+1):
    for prime in primes:
        while j % prime == 0:
            j //= prime
            c[prime] += 1

ans = 1
for cnt in c.values():
    ans *= cnt 
print(ans%MOD)

Solution (Python):
from collections import defaultdict

def read_input():
    n = int(input())

    return n


def factorizer(x):
    limit = x

    factors = []
    t = x
    for i in range(2, limit + 1):
        while t % i == 0:
            factors.append(i)
            t /= i

    if not factors:
        factors.append(x)

    return factors


def submit():
    n = read_input()

    factors_occur = defaultdict(int)

    for i in range(2, n + 1):
        factors = factorizer(i)

        for f in factors:
            factors_occur[f] += 1

    occurs = [o for (k, o) in factors_occur.items()]

    acc = 1
    maxmod = (10**9) + 7
    for power in occurs:
        acc *= (power + 1)

    print(acc % maxmod)

if __name__ == '__main__':
    submit()

Solution (Python):
mod = 10**9+7
n = int(input())

def get_primes(n):
    if n < 2:
        return []

    primes = [i for i in range(n)]
    primes[1] = 0

    
    for prime in primes:
        if prime**2 > n:
            break
        if not prime:
            continue
        for non_prime in range(2 * prime, n, prime):
            primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

d = {}
for p in get_primes(n+1):
    q = p
    while n >= q:
        d[p] = d.get(p, 1) + n//q
        q *= p
ans = 1
for i in d.values():
    ans *= i
    ans %= mod
print(ans)

Solution (Python):
N = int(input())


def prime_factorize(N: int) -> list:
    res = []
    pn = 2
    while N != 1:
        exp = 0
        while N % pn == 0:
            N /= pn
            exp += 1
        if exp:
            res.append([pn, exp])
        pn += 1
    return res


pn = []
for i in range(2, N+1):
    for j in prime_factorize(i):
        flg = 0
        if pn:
            idx = 0
            for k in pn:
                if k[0] == j[0]:
                    pn[idx][1] += j[1]
                    flg = 1
                    break
                idx += 1
        if not flg:
            pn.append(j)

ans = 1
for i in pn:
    tmp = (i[1] + 1) % (10**9 + 7)
    ans *= tmp
    ans %= (10**9 + 7)

print(ans)

Solution (Python):
from collections import Counter
N = int(input())
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
num = Counter()
for n in range(1, N + 1):
    factors = prime_factors(n)
    num.update(factors)
x = 1
for _, n in num.items():
    x *= (n + 1)
    x %= 10 ** 9 + 7
print(x)

Solution (Python):
N = int(input())

ans = 1
soin = {}

for i in range(2, N+1):
    k = i
    for j in range(2, i+1):
        while(k//j == k/j):
            if j in soin:
                soin[j] += 1
            else:
                soin[j] = 1
            k //= j

        if k == 1:
            break

for v in soin.values():
    ans = (ans * (v+1)) % (10**9 + 7)
print(ans)

Solution (Python):
from collections import Counter
n = int(input())
MOD = 10**9 + 7

def factorize(n):
    b = 2
    fct = []
    while b*b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b+1
    if n > 1:
        fct.append(n)
    return fct

cnt = Counter()
for i in range(1,n+1):
    cnt.update(factorize(i))

ans = 1
for key in cnt.keys():
    ans *= cnt[key] + 1
    ans = ans % MOD
print(ans)

Solution (Python):
import math

n = int(input())

lim = n


def isPrime(num):
    
    if num < 2: return False
    
    elif num == 2: return True
    
    elif num % 2 == 0: return False

    
    
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    
    return True


def callIsPrime(input_num):
    numbers = []
    
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    
    return numbers


prime = callIsPrime(n+1)

arr = [0] * len(prime)

for i in range(len(prime)):
  j = 1
  while n >= prime[i] ** j :
    arr[i] += int(n / prime[i] ** j)
    j += 1
  
ans = 1
for i in arr :
  if i != 0:
    ans *= i+1

print(ans % (10 ** 9 + 7))

Solution (Python):
import math
from functools import reduce
n = int(input())

n_frac = math.factorial(n)

_n_frac = n_frac
prime_numbers = {}

for i in range(2, n_frac +1):
    if _n_frac == 1:
        break
    while True:
        div, mod = divmod(_n_frac, i)
        if mod != 0:
            break
        _n_frac = div
        if i in prime_numbers:
            prime_numbers[i] += 1
        else:
            prime_numbers[i] = 1

n_divisor = reduce(lambda x,y:x*(y+1), prime_numbers.values(), 1 )
result = n_divisor % (10**9 +7)

print(result)

Solution (Python):
import sys
from collections import defaultdict

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        return is_prime

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    prime = []
    for i in range(n+1):
        if is_prime[i]:
            prime.append(i)

    return prime


def main():
    input = sys.stdin.readline
    N = int(input())
    MOD = 10**9 + 7

    if N == 1:
        return 1

    prime = sieve(N)
    d = defaultdict(lambda: 0)
    for i in range(2, N+1):
        m = i
        for p in prime:
            if p > m:
                break

            while m % p == 0:
                d[p] += 1
                m //= p
    
    ans = 1
    for key in d.keys():
        ans *= d[key] + 1

    return ans % MOD


if __name__ == '__main__':
    print(main())

Solution (Python):
import math



def is_prime(n):
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            return False
    return True



def get_divisor(n, is_sort=False):
    divisors = [1]
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            divisors.append(i)
            other_div = n // i
            if i != other_div:
                divisors.append(other_div)
    divisors.append(n)
    if is_sort:
        divisors.sort()
    return divisors



def prime_factor(n):
    factors = {}
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            factors[i] = 0
        while n % i == 0:
            n = n // i
            factors[i] += 1
        if n == 1:
            break
    if n != 1:
        factors[n] = 1
    return factors


if __name__ == '__main__':
    n = int(input())
    prime_dict = {}
    for i in range(2, n + 1):
        prime_dict[i] = 1
        for key, value in prime_factor(i).items():
            prime_dict[key] += value

    ans = 1
    for i in prime_dict.values():
        ans = ans * i
    print(ans % (10 ** 9 + 7))

Solution (Python):
n = int(input())
t = [0]*n
f = 1
mod = 10**9+7
for i in range(2,n+1):
  fa = 1
  while i > 1:
    fa += 1
    while i % fa == 0:
      i = i//fa
      t[fa-2] += 1

for j in range(n):
  f = f*(t[j]+1)%mod
print(f)

Solution (Python):
N = int(input())
import math
def is_prime(num):
    if num < 2:
        return False
    if num == 2 or num == 3 or num == 5:
        return True
    if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
        return False

    
    prime = 7
    step = 4
    num_sqrt = math.sqrt(num)
    while prime <= num_sqrt:
        if num % prime == 0:
            return False
        prime += step
        step = 6 - step

    return True
  
def make_prime_list(num):
    if num < 2:
        return []

    prime_list = []
    for prime in range(2, num + 1):
        if is_prime(prime):
            prime_list.append(prime)
    return prime_list
  
num = N
prime_list = make_prime_list(num)
pcount={}
for p in prime_list:
    pcount[p]=0
for nn in range(2,num+1):
    for p in prime_list:
        n=nn
        if n<p:
            break
        while n%p==0:
            n//=p
            pcount[p]+=1
            
ans = 1
for i in pcount.values():
    ans *= (i + 1)
print(ans % (10 ** 9 + 7))

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    N = int(input().rstrip())
    factor = []
    f = math.factorial(N)
    dict = {}
    ans = 1
    for num in range(2,1000):
        while f % num == 0:
            f //= num
            factor.append(num)
            if num in dict:
                dict[num] += 1
            else:
                dict[num] = 1
    for v in dict.values():
        ans *= v + 1

    print(ans % (10**9 + 7))
    
if __name__ == '__main__':
    main()

Solution (Python):
import math

PN = []
def buildPrimeNumber(N):
	global PN
	for n in range(2, N + 1):
		f = True
		for m in range(2, n):
			if 0 == n % m:
				f = False
				break
		if f:
			PN.append(n)

buildPrimeNumber(1000)

C = dict()
def primeFactorization(N):
	global C
	for pn in PN:
		if N % pn:
			continue
		c = 0
		while 0 == N % pn:
			c += 1
			N //= pn
		C[pn] = c
	if N == 1:
		return
	else:
		C.clear()

N = int(input())
f = math.factorial(N)

primeFactorization(f)

r = 1
for c in C.values():
	r *= (c + 1)
print(r % (10**9 + 7))

Solution (Python):
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x//i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Solution (Python):
def is_prime(n):
    if n <= 1:
        return False
    elif n == 2:
        return True
    else:
        for i in range(2, int((n**(1/2)))+1):
            if n % i == 0:
                return False
        return True

from collections import Counter
N = int(input())
MOD = 10**9+7

primes = [i for i in range(N+1) if is_prime(i)] 

c = Counter(primes) 
                    
                    

for j in range(2, N+1):
    for prime in primes:
        while j % prime == 0:
            j //= prime
            c[prime] += 1

ans = 1
for cnt in c.values():
    ans *= cnt 
print(ans%MOD)

Solution (Python):
def getPrimeFactorsList(num):
  pn = 2 
  pflist = [] 
  while pn * pn <= num: 
    while num % pn == 0: 
      num = num / pn
      pflist.append(pn)
    pn += 1 
  if num > 1:
    pflist.append(int(num))
  return pflist

mod = (10 ** 9 + 7)
N = int(input())
ans = 0


pf_dict = {}

for i in range(2, N+1):

  pflist = getPrimeFactorsList(i)
  pfset = set(pflist)
  for j in pfset:
    if j in pf_dict:
      pf_dict[j] += pflist.count(j)
    else:
      pf_dict[j] = pflist.count(j)
    
  
count = 1
for v in pf_dict.values():
  count *= (v + 1)
print(count % mod)

Solution (Python):
N = int(input())
prime = [0]*(N+1)
ans = 1
for i in range(2,N+1):
    d = 1
    while i > 1:
        d+=1
        while i % d == 0:
            i = i//d
            prime[d]+= 1
for j in range(N+1):
    ans = ans *(prime[j]+1)%(10**9+7)
print(ans)

Solution (Python):
from collections import defaultdict
N = int(input())
dic = defaultdict(int)
for n in range(2, N + 1):
    for i in range(2, n):
        if i * i > n:
            break
        while n % i == 0:
            dic[i] += 1
            n //= i
    if n > 1:
        dic[n] += 1
ans, MOD = 1, 10 ** 9 + 7
for key in dic:
    ans = ans * (dic[key] + 1) % MOD
print(ans)

Solution (Python):
p=(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997)
r=[1]*168
n=int(input())
for i in range(n):
  x=i+1
  for j in range(168):
    while x%p[j]==0:x//=p[j];r[j]+=1
ans=1
for i in r:ans*=i;ans%=10**9+7
print(ans%(10**9+7))

Solution (Python):
def dict_count(dict, key):
	if key in dict:
		dict[key] = dict[key]+1
	else:
		dict[key] = 1
	return dict

N = int(input())
divs = {}
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for n in range(2, N+1):
	for p in primes:
		while n%p==0:
			divs = dict_count(divs, p)
			n = n//p
		if p*p>n:
			break
	if n!=1:
		dict_count(divs, n)
result = 1
base = 10**9+7
for c in divs.values():
	result = (result*(c+1))%base
print(result)

Solution (Python):
from math import sqrt, ceil


def mul(iterable, mod: int = None)->int:
    ret = 1
    for v in iterable:
        ret *= v
        if mod:
            ret %= mod
    return ret


def factors_of_factorial(N: int)->int:
    prime_factors = {}

    for n in range(2, N+1):
        d = 2
        while n > 1:
            if n % d == 0:
                prime_factors.setdefault(d, 0)
            while n % d == 0:
                prime_factors[d] += 1
                n //= d
            d += 1
    return mul((p+1 for p in prime_factors.values()), mod=10**9+7)


if __name__ == "__main__":
    N = int(input())
    ans = factors_of_factorial(N)
    print(ans)

Solution (Python):
n = int(input())

ans = 1
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]

for p in prime:
	cnt = 0
	i = p
	while i <= n:
		cnt+=n // i
		i*=p
	ans = ans * (cnt + 1) % 1000000007

print(ans)

Solution (Python):
from collections import Counter
N = int(input())
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
factors2 = []
for i in range(N):
    factors2.extend(prime_factors(i+1))
cc = Counter(factors2)
ans = 1
inf = 10 ** 9 + 7 
for c in cc.items():
    ans *= c[1]+1
if N == 1:
    print(1)
else:
    print(ans % inf)

Solution (Python):
sosu=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
n=int(input())
ans=1
p=10**9+7
for i in sosu:
  if i<=n:
    stack=0
    num=i
    while num<=n:
      stack+=n//num
      num*=i
    ans*=(stack+1)
    ans%=p
print(ans)

Solution (Python):
N=int(input())
primes = [2,3,5,7,11,13,17,19,23,29,31,37]
mod=int(1e9+7)

memo={}
for n in range(1,N+1):
  for p in primes:
    while not n%p:
      memo[p] = memo.get(p,0)+1
      n=n//p
  if n!=1:
    memo[n] = memo.get(n,0)+1



answer=1
for v in memo.values():
  answer =answer * (v+1) %mod
print(answer)

Solution (Python):
import math
MOD = 10 ** 9 + 7

N = int(input())

prime_list = [2]
for i in range(2, N + 1):
    if all(i % j != 0 for j in range(2, math.ceil(math.sqrt(i)) + 1)):
        prime_list.append(i)

d = {}
for prime in prime_list:
    d[prime] = 0


for i in range(2, N + 1):
    num = i
    for prime in prime_list:
        if num % prime == 0:
            while True:
                d[prime] += 1
                num /= prime
                if num % prime != 0:
                    break 

ans = 1
for key in d.keys():
        ans *= (d[key] + 1)
        ans %= MOD
print(ans)

Solution (Python):


import math

n = int(input())

def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisor(fac):
    temp = 1
    for i in range(len(fac)):
        temp *= (fac[i][1] + 1)
    return temp

print(divisor(factorize(math.factorial(n))) % 1000000007)

Solution (Python):
solist=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
sosu=[0 for i in range (len(solist))]
N=int(input())
for n in range(1,N+1):
    num=n
    for p in range(len(solist)):
        while num%solist[p]==0:
            sosu[p]+=1
            num=num//solist[p]
ans=1
for j in sosu:
    ans*=j+1
    ans=ans%(10**9+7)
print(ans)