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 sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

n=int(input())
if n==1:
    print(1)
    exit()
d=defaultdict(int)
for i in range(2,n+1):
    tmp=factorization(i)
    for j in tmp:
        yaku,ko=j
        d[yaku]+=ko

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

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(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 is_prime


def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0: continue
        ex = 0

        while (n % i == 0):
            ex += 1
            n //= i
        res.append((i, ex))
    if n != 1: res.append((n, 1))
    return res

N = iin()
ex = [0 for _ in range(N+1)]
for i in range(2, N+1):
    pf = prime_factorize(i)
    for p in pf:
        ex[p[0]] += p[1]
ans = 1
for i in range(2, N+1):
    ans *= ex[i]+1
    ans %= MOD
print(ans)

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


def prime_factorize(n):
    primelist=[]
    a=2
    n_origin=n
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist
mod=10**9+7
dic={}
ans=1
for i in range(2,n+1):
    pfs=prime_factorize(i)
    for j in range(len(pfs)):
        dic[pfs[j][0]]=dic.get(pfs[j][0],0)+pfs[j][1]
for v in dic.values():
    ans=(ans*(v+1))%mod
print(ans)

Solution (Python):
from collections import Counter

MOD = 10 ** 9 + 7


def factorization(n):
    arr = dict()
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if not arr and n != 1:
        arr[n] = 1

    return arr


ct = Counter()
for i in range(2, int(input()) + 1):
    ct.update(factorization(i))

ans = 1
for t in ct.values():
    ans = (ans * (t + 1)) % MOD
print(ans)

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

mod = 10**9 + 7
d = {}

for i in range(2,n+1):
	x = i
	for j in range(2,x+1):
		while x % j == 0:
			x = x // j
			d[j] = d.get(j, 0) + 1

ret = 1
for v in d.values():
	ret *= v+1

print(ret % mod)

Solution (Python):



N = int(input())


prime_number_list = []
for n in range(2, N+1):
    is_prime_number = True
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            is_prime_number = False
    if is_prime_number:
        prime_number_list.append(n)



result = 1
for pn in prime_number_list:
    n = 1
    count = 0
    while pn**n <= N:
        count += N // (pn**n)
        n += 1
    result *= count + 1


print(result%(pow(10,9)+7))

Solution (Python):
d={}
for i in range(int(input())+1):
  for j in d:
    while i%j<1: d[j]+=1; i//=j
  if i>1: d[i]=2
a=1
for v in d.values(): a=a*v%(10**9+7)
print(a)

Solution (Python):
d={}
for i in range(int(input())+1):
  for j in d:
    while i>j-1 and i%j<1: d[j]+=1; i//=j
  if i>1: d[i]=2
a=1
for v in d.values(): a=a*v%(10**9+7)
print(a)

Solution (Python):
d={}
for i in range(int(input())+1):
  for j in d:
    while i>1 and i%j<1: d[j]+=1; i//=j
  if i>1: d[i]=2
a=1
for v in d.values(): a=a*v%(10**9+7)
print(a)

Solution (Python):
d={}
for i in range(int(input())+1):
  for j in d:
    while i>1 and i%j<1:
      d[j]+=1
      i//=j
  if i>1:
    d[i]=2
a=1
for v in d.values():
  a=a*v%(10**9+7)
print(a)

Solution (Python):
mod = 10**9+7
from collections import defaultdict
def sieve(N):
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    prime.sort()
    prime.reverse()
    for k in range(N-1):
        if prime[k+1] == 0:
            end = k
            break
    return prime[:end+1]

def main():
    N = int(input())
    if N == 1:
        print(1)
        exit()
    prime = sieve(N)
    prime.reverse()
    lis = defaultdict(int)
    for i in range(1,N+1):
        t = i
        for p in prime:
            if p > i:continue
            if t%p == 0:
                while t%p == 0:
                    t //= p
                    lis[p] += 1
    ans = 1
    for l in lis.values():
        ans *= (l+1)
        ans %= mod
    
    print(ans)

    

if __name__ == "__main__":
    main()

Solution (Python):
from math import sqrt, factorial

n = int(input())

MAX_VAL = n
prime = [1] * (MAX_VAL+1)
prime[0] = prime[1] = 0
for i in range(2, int(sqrt(MAX_VAL))+1):
    if prime[i]:
        for k in range(2*i, MAX_VAL+1, i):
            prime[k] = 0

res = 1
for i, p in enumerate(prime):
    m = factorial(n)
    if p:
        cnt = 0
        while m % i == 0:
            cnt += 1
            m //= i
        res *= cnt + 1
        res %= 10**9+7

print(res)

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

def chk_prime(n):
    sq=int(math.sqrt(n))
    for i in range(2,sq+1):
        if n%i==0:
            return False
    return True
primes=[]
for i in range(2,n+1):
    if chk_prime(i):
        primes.append(i)

ans=1
mod=10**9+7
for i in primes:
    cnt=0
    for j in range(i,n+1,i):
        num=j
        while num%i==0:
            num//=i
            cnt+=1
    ans=(ans*(cnt+1))%mod
print(ans)

Solution (Python):
import math
from collections import Counter

n = int(input())
prime_count = Counter()
def prime_c(m):
  for i in range(2, math.ceil(math.sqrt(m))+1):
    while m % i == 0:
      m /= i
      prime_count[i] += 1
  if m > 1:
    prime_count[int(m)] += 1  

for i in range(2, n+1):
  prime_c(i)

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

Solution (Python):
from collections import defaultdict as dd
N = int(input())

waru = 1000000007

def pwari(n):
    th = round(n ** 0.5)
    ans = (n,1)
    for i in range(2,th+1):
        if n % i ==0:
            ans = (i,n//i)
            break
            
    return(ans)

def soinsu(n):
    pf_dic = dd(lambda:0)
    
    flag = 1
    
    while flag:

        waru,red = pwari(n)[:]
        if waru == n:
            pf_dic[str(waru)] += 1
            flag = 0
        else:
            pf_dic[str(waru)] += 1
            n = red
    return(pf_dic)

p_dic = dd(lambda:0)
for i in range(1,N+1):
    pf_dic = soinsu(i)

    for p in pf_dic.keys():

        p_dic[p] += pf_dic[p]


ans = 1
for p in p_dic.keys():
    if p == "1":
        pass
    else:
        ans *= (p_dic[p]+1)
    
print(ans % waru)

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

def fact(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

from collections import defaultdict
d = defaultdict(int)
for i in range(1,n):
    num=i+1
    for div in fact(num):
        d[div[0]]+=div[1]

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

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

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

prod = [0]*(N+1)
for i in range(2,N+1):
  for p in factorize(i):
    prod[p] += 1
ans = 1

for i in range(2,N+1):
  ans *= prod[i]+1
  ans %= 10**9+7
print(ans)

Solution (Python):
n = int(input())
mod = 10**9+7
s = [0] * (n+1)

for i in range(2, n+1):
    p = 2
    while i>1:
        while i%p==0:
            i //= p
            s[p] += 1
        p += 1

ans = 1
for i in s:
    ans *= i+1
    ans %= mod

print(ans)

Solution (Python):

N = int(input())

isPrime = [True]*(N+1)

isPrime[0] = False
isPrime[1] = False

for i in range(2, N + 1):
    if isPrime[i]:
        for j in range(2*i, N + 1, i):
            isPrime[j] = False


factors = []

for p in range(2, N+1):
    if not isPrime[p]:
        continue

    f = 0
    base = p
    while base <= N:
        f += N // base
        base *= p

    if f > 0:
        factors.append(f)

ans = 1
m = 10**9 + 7
for f in factors:
    ans *= (f+1)
    if ans >= m:
        ans %= m

print(ans)

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N =int(input())

facters = {}

for i in range(1, N+1):
  
  arr = factorization(i)
  for key,value in arr:
    if key in facters:
      facters[key] += value
    else:
      facters[key] = value

ans = 1

facters.pop(1)

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

Solution (Python):



N = int(input())

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

def get_prime_factor(n):
    from collections import defaultdict
    res = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break
        while n % i == 0:
            res[i] = res[i] + 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res

prime_factor = get_prime_factor(n)

factors_count = 1
for count in prime_factor.values():
    factors_count = factors_count * (count + 1)

res = factors_count % (10 ** 9 + 7)
print(res)

Solution (Python):
import collections 
na=int(input())
n=1
mod = 10**9+7
for i in range(2,na+1):
    n*=i


n_break=[]
i=2
while i<=n:
    if n%i==0:
        n_break.append(i)
        n=n//i
    else:
        i+=1

ans=1
count=collections.Counter(n_break)
for v in count.values():
    ans*=(v+1)  

print(ans%mod)

Solution (Python):
from collections import Counter, defaultdict
from itertools import count
from functools import reduce


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


def prime_factor(n):
  c = defaultdict(int)
  for i in count(2):
    if i * i > n:
      break
    while n % i == 0:
      c[i] += 1
      n //= i;
  if n != 1:
    c[n] = 1
  return Counter(c)

counter = reduce(
  lambda a, i: a + prime_factor(i),
  range(N, 1, -1),
  Counter()
)
  
answer = reduce(
  lambda a, c: (a * (c + 1)) % MOD,
  counter.values(),
  1
)

print(answer)

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

INF = 10**9 + 7

s = [0] * (n+1)

for i in range(1, n+1):
    ni = i
    p = 2
    while ni > 1:
        while ni % p == 0:
            ni //= p
            s[p] += 1
        p += 1

ans = 1
for i in s:
    ans *= i+1

print(ans % INF)

Solution (Python):

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

div = [0 for _ in range(n)]
for i in range(1, n+1):
    x = i
    for j in range(2, x+1):
        while x % j == 0:
            x //= j
            div[j-1] += 1
ans = 1
for i in range(n):
    ans = ans * (div[i] + 1) % mod

print(ans)

Solution (Python):
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
a = []
for i in range(2,n+1):
    a += prime_factorize(i)
b = set(a)
c = collections.Counter(a)
ans = 1
for i in b:
    ans *= c[i]+1
    ans %= 10**9+7
print(ans)

Solution (Python):

import math
from collections import Counter
from collections import defaultdict
mod = 10**9+7 

def prime(n):
  for i in range(2, math.ceil(math.sqrt(n))+1):
    while n % i == 0:
      n /= i
      prime_count[i] += 1
  if n > 1:
    prime_count[int(n)] += 1

n = int(input())
a = 1
prime_count = defaultdict(int)
for i in range(1, n+1):
  prime(i)

ans = 1
for v in prime_count.values():
  ans *= (v+1)
  ans %= mod 
print(ans)

Solution (Python):
from collections import defaultdict
n=int(input())
mod=10**9+7
d=defaultdict(int)
for i in range(2,n+1):
  c=i
  for j in range(2,c+1):
    if c%j==0:
      cnt=0
      while c%j==0:
        cnt+=1
        c//=j
      d[j]+=cnt
ans=1
for v in d.values():
  ans=(ans*(v+1))%mod
print(ans)

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

x = 1
for i in range(1, n+1):
    x *= i

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections
c = collections.Counter(prime_factorize(x))
y = list(c.values())

z = 1
for j in range(len(y)):
    z *= (y[j]+1)

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

Solution (Python):

def prime_factorize(N):
    res = [0] * (N+1)
    for n in range(2,N+1):
        a = 2
        while a*a <= n:
            if n % a == 0:
                ex = 0
                while n % a == 0:
                    ex += 1
                    n //= a
                
                res[a] += ex
            a += 1
        if n != 1:
            res[n] += 1
    return res

N = int(input())
prime = prime_factorize(N)

mod = 10 ** 9 + 7
ret = 1
for i in prime:
    ret *= (i+1)
    ret %= mod

print(ret)

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

primes = list()

for i in range(2, N+1):
    for j in primes:
        if i % j == 0:
            break
    else:
        primes.append(i)

ans = 1
for p in primes:
    x = 1
    q = p
    while q <= N:
        for i in range(2, N+1):
            if i % q == 0:
                x += 1
        q *= p
    ans = ans * x % mod

print(ans)

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

divisor_dic = {}

for i in range(1, n+1):
    while i % 2 == 0:
        if not 2 in divisor_dic:
            divisor_dic[2] = 1
        else:
            divisor_dic[2] += 1
        i //= 2
    f = 3
    while f*f <= i:
        if i % f ==0:
            if not f in divisor_dic:
                divisor_dic[f] = 1
            else:
                divisor_dic[f] += 1
        
            i //= f
        
        else:
            f += 2
    
    if i != 1:
        if not i in divisor_dic:
            divisor_dic[i] = 1
        else:
            divisor_dic[i] += 1
                
c = 1          
for v in divisor_dic.values():
    c *= (v+1)
    c %= 10**9+7

print(c)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7
d = {}
def prime_factorization(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            if d.get(i) is None:
                d[i] = 1
                n //= i
            while n % i == 0:
                n //= i
                d[i] += 1
        i += 1
    if n > 1:
        if d.get(n) is None:
            d[n] = 1
        else:
            d[n] += 1


def main():
    N = int(readline())

    for i in range(1,N+1):
        prime_factorization(i)
    
    ans = 1
    for v in d.values():
        ans *= v + 1
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import functools

def prime_factor(n):
    res = {}
    i = 2
    while i * i <= n:
        while n % i == 0:
            res[i] = 1
            n //= i
        i+=1
    if n != 1:
        res[n] = 1
    return res.keys()
    
N = int(input())
target = functools.reduce(lambda a, b: a * b, range(1, N + 1))

factors = prime_factor(target)
total = 1
for f in factors:
    count = 1
    while target % f == 0:
        target //= f
        count += 1
    
    total *= count

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

Solution (Python):
from collections import Counter
div = 10**9 + 7

def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

m = int(input())
a = Counter()

for i in range(2,m+1):
    a += Counter(pf(i))

ans = 1
for i in range(1,1001):
    if a[i] == 0:
        continue
    else:
        ans = ans * (a[i] + 1) % div
        
print(ans)

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

n = int(input())

S = [0] * (n+1)

for i in range(1, n+1):
    n_i = i
    p = 2 
    while n_i > 1:
        while n_i % p == 0:
            n_i //= p
            S[p] += 1
        p += 1

ans = 1
for s in S:
    ans *= s+1

print(ans % MOD)

Solution (Python):
def resolve():
    n = int(input())
    S = [0]*(n+1)
    MOD = (10 ** 9) + 7

    for i in range(1, n+1):
        n_i = i
        p = 2
        while n_i > 1:
            while n_i % p == 0:
                n_i //= p
                S[p] += 1
            p += 1

    ans = 1
    for s in S:
        ans *= s+1
    print(ans % MOD)


if __name__ == '__main__':
    resolve()

Solution (Python):
N = int(input())
table = [0]*(N+2)
def factorize2(n): 
    i = 2
    m = 1
    
    sign = -1
    while i * i <= n:
        j = 0
        while n % i == 0:
            n //= i
            j += 1
        if j != 0:
            table[i] += j
        if i >= 5:
            if sign < 0:
                sign = 1
                i = 6*m + sign
            else:
                m += 1
                sign = -1
                i = 6*m + sign
        elif i == 2:
            i += 1
        elif i == 3:
            i = 5
    if n > 1:
        table[n] += 1
    return table 


for i in range(2,N+1):
    factorize2(i)
ans = 1
for i in range(len(table)):
    if table[i] > 0:
        ans *= table[i]+1
        ans %= 10**9+7

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class Sieve:
    def __init__(self, n):
        self.plist = [2]  
        min_prime_factor = [2, 0] * (n // 2 + 5)
        for x in range(3, n + 1, 2):
            if min_prime_factor[x] == 0:
                min_prime_factor[x] = x
                self.plist.append(x)
                if x ** 2 > n: continue
                for y in range(x ** 2, n + 5, 2 * x):
                    if min_prime_factor[y] == 0:
                        min_prime_factor[y] = x
        self.min_prime_factor = min_prime_factor

    def isprime(self, x):
        return self.min_prime_factor[x] == x

    
    def pfct(self, x):
        pp, ee = [], []
        while x > 1:
            mpf = self.min_prime_factor[x]
            if pp and mpf == pp[-1]:
                ee[-1] += 1
            else:
                pp.append(mpf)
                ee.append(1)
            x //= mpf
        return [(p, e) for p, e in zip(pp, ee)]

def main():
    md=10**9+7
    sv=Sieve(1005)
    cnt_e=[0]*1005
    for a in range(2,II()+1):
        pe=sv.pfct(a)
        for p,e in pe:cnt_e[p]+=e
    ans=1
    for e in cnt_e:ans=ans*(e+1)%md
    print(ans)

main()

Solution (Python):
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n%i == 0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass


n = int(input())

prime = []
for i in range(2, n+1):
    prime = prime + prime_factor(i)

from collections import Counter

primec = Counter(prime)

ans = 1

primec_list = primec.most_common()

mod = 10**9+7

for p in primec_list:
    ans = ans * (p[1]+1) % mod

print(ans)

Solution (Python):
import math

def is_prime(n):
  if n & 0: return False
  for i in range(2, int(math.sqrt(n))+1):
    if n % i == 0:
      return False
  return True
  
def prime(n):
  if n < 2: return []
  P = [2]
  for i in range(3, n+1):
    if is_prime(i):
      P.append(i)
  return P

n = int(input())
P = prime(n)
cnt = [0]*len(P)

for i in range(2, n+1):
  x = i
  pi = 0
  while x > 1 and pi < len(P):
    if x % P[pi] == 0:
      cnt[pi] += 1
      x //= P[pi]
    else:
      pi += 1

ans = 1
for c in cnt:
  ans *= c+1
  ans %= 10**9 + 7
print(ans)

Solution (Python):



def prime_factorize(N):
    f = []
    while N % 2 == 0:
        f.append(2)
        N //= 2
    i = 3
    while i * i <= N:
        while N % i == 0:
            f.append(i)
            N //= i
        i += 2
    
    if N != 1:
        f.append(N)
    return f


N = int(input())
MOD = 10**9 + 7
exp = [0] * (N+1)

for i in range(2, N+1):
    F = prime_factorize(i)
    for j in range(len(F)):
        exp[F[j]] += 1

ans = 1
for i in range(N+1):
    ans *= exp[i] + 1
    ans %= MOD
print(ans)

Solution (Python):
from collections import defaultdict
from collections import Counter



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
    
d = defaultdict(lambda: 0)

if N == 1:
    print(1)
else:
    for i in range(2, N+1):
        a = prime_factorize(i)
        c = Counter(a)
        for k, v in c.items():
            d[k] += v

    count = 1
    for v in d.values():
        count *= (v + 1)
        count %= int(1e9+7)
    print(count)

Solution (Python):
from collections import defaultdict

n=int(input())
mod=10**9+7
d=defaultdict(int)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])

    for i in range(len(arr)):
        d[arr[i][0]]+=arr[i][1]
    return

ans=1
for i in range(1,n+1):
    factorization(i)

for i,m in d.items():
    if i!=1:
        ans*=(m+1)
        ans%=mod
print(ans)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    
    
    def factorization(n):
        if n==1:
            return [0,1]
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])

        return arr
    
    N=I()
    ans=1
    L=[0]*(N+1)
    for i in range(2,N+1):
        arr=factorization(i)
        for j in range(len(arr)):
            L[arr[j][0]]+=arr[j][1]
    
    for i in range(len(L)):
        ans*=(L[i]+1)
        ans%=mod
    print(ans)
    

main()

Solution (Python):
def resolve():
    n = int(input())
    M = 10 ** 9 + 7
    pl = [0] * (n + 1)

    for i in range(2, n+1):
        x = i
        p = 2
        while x > 1:
            while x % p == 0:
                pl[p] += 1
                x //= p
            p += 1
    ans = 1
    for s in pl:
        ans *= (s+1)

    print(ans % M)

if __name__ == '__main__':
    resolve()

Solution (Python):

import math
import sys
import itertools
import numpy as np
import functools
mo = 1000000007
r = range
    
n = int(input())
    
primes = set()
for i in r(2, 1000):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)
    
d = {}
for i in r(2, n+1):
    x = i
    while x != 1:
        for p in primes:
            if x % p != 0:
                continue
            x //= p
            if p not in d:
                d[p] = 0
            d[p] += 1
            break
    
ret = 1
for i in d.values():
    ret *= (i+1)
    ret %= mo
    
print(ret)

Solution (Python):
MAX_PRIME = 10**5
is_prime = [1] * MAX_PRIME
primes = []
is_prime[0] = 0
is_prime[1] = 0
for i in range(MAX_PRIME):
    if is_prime[i]:
        primes.append(i)
        for j in range(2, ((MAX_PRIME-1)//i) + 1):
            is_prime[i*j] = 0

m = int(input())
mod = 10 ** 9 + 7
factor = [0] * (m+1)
for n in range(1, m+1):
    for p in primes:
        if p ** 2 > n:
            break
        while n % p == 0:
            n //= p
            factor[p] += 1
    if n > 1:
        factor[n] += 1

ans = 1
for x in factor:
    if x:
        ans *= x+1
        ans %= mod
print(ans)

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
if n == 1:
    print(1)
    exit()
cnt = [0] * (n+1)
for i in range(1, n+1):
    val = 1
    arr = factorization(i)
    for j in arr:
        cnt[j[0]] += j[1]
ans = 1
for i in range(2, n+1):
    ans *= cnt[i] + 1
    if ans >= 10**9+7:
        ans %= 10**9+7
print(ans)

Solution (Python):
from math import sqrt,ceil
n = int(input())
d = [0] * (n+1)
INF = int(1e9)+7
def prime_factor(x):
    for i in range(2,ceil(sqrt(n))+1):
        while x % i == 0:
            d[i] += 1
            x //= i
    if x != 1:
        d[x] += 1
    return
for i in range(1, n+1):
    prime_factor(i)
ans = 1
for i in range(n+1):
    if d[i] != 0:
        ans *= d[i] + 1
        ans %= INF
print(ans)

Solution (Python):
mod = 1000000000 + 7

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
dat = [0] * 2000 


res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]

for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod

print(res)

Solution (Python):
n=int(input())
array=[]
for i in range(2,n+1):
    s=i
    while s!=1:
        turn=0
        for j in range(2,s+1):
            if s%j==0:
                s=s//j
                array.append(j)
                break
ans=1
import collections
c=collections.Counter(array)
l=list(c.values())
for i in range(len(l)):
    ans*=l[i]+1
print(ans%(10**9+7))

Solution (Python):
def the_sieve_of_eratosthenes(i):
    s = [j for j in range(2, i + 1)]
    j = 0
    while True:
        if j >= i - 3:
            for k in range(len(s) - 1, 0, -1):
                if s[k] == 0:
                    del s[k]
            return s
        if s[j] != 0:
            for k in range(2 * s[j] - 2, i - 1, s[j]):
                s[k] = 0
        j += 1

n = int(input())
p = the_sieve_of_eratosthenes(10 ** 3 + 9)
c = [0] * len(p)
j = 0
for i in range(2, n + 1):
    if i == p[j]:
        c[j] += 1
        j += 1
    else:
        k = 0
        m = i
        while True:
            if m == 1:
                break
            if m % p[k] == 0:
                c[k] += 1
                m /= p[k]
            else:
                k += 1
ans = 1
for i in c:
    ans *= i + 1
    if ans >= 10 ** 9 + 7:
        ans %= 10 ** 9 + 7
print(ans)

Solution (Python):
from collections import defaultdict
n = int(input())
f = defaultdict(int)


def fact(n, d):
    div = 2
    while n > 1 and div * div <= n:
        if n % div == 0:
            n //= div
            d[div] += 1
        else:
            div += 1
    if n > 1:
        d[n] += 1


for i in range(2, n+1):
    fact(i, f)
ans = 1
mod = 10**9 + 7
for k,v in f.items():
  ans = (ans * (v+1)) % mod
print(ans)

Solution (Python):
def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
      a.append(n)
  return a

n=int(input())

x=[0]*1000
for i in range(2,n+1):
  p=prime_factorize(i)
  for _ in p:
    x[_]+=1

ans=1
for _ in x:
  if _ > 0:
    ans=(ans*(_+1))%(10**9+7)

print(ans)

Solution (Python):
n=int(input())
s,ans,num =1,1,2
for i in range(2, n+1):
  s*=i
l=[]
while s!=1:
  if not s%num:
    l.append(num)
    s//=num
  else:
    num+=1
for i in set(l):
  ans*=l.count(i)+1
print(ans%(10**9+7))