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):



















from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

import math


class Prime:
    seed_primes = [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]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

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

    def is_prime_miller_rabin(self, n):
        d = n - 1
        while d & 1 == 0:
            d >>= 1

        witnesses = self.get_witnesses(n)

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

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

    @staticmethod
    def f(x, n, seed):
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes



n = int(input())

prime = Prime()
d = {}
for i in range(1, n+1):
    for k, v in prime.find_factors(i).items():
        if not k in d:
            d[k] = 0
        d[k] += v

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

Solution (Python):
memo={}
def primes(n):
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            if d in memo:
                memo[d]+=1
            else:
                memo[d]=1
            n //= d
        d += 1
    if n > 1:
        if n in memo:
            memo[n]+=1
        else:
            memo[n]=1
    return None
n=int(input())
for i in range(1,n+1):
    primes(i)
ans=1
for i in memo.items():
    ans*=i[1]+1
print(ans%(10**9+7))

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

def eratosthenes(n):
  primes=[True for i in range(n+1)]
  p=2
  while(p*p<=n):
    if primes[p]==True:
      for i in range(p*2,n+1,p):
        primes[i]=False
    p+=1
  ls=[]
  for i in range(2,n+1):
    if primes[i]:
      ls.append(i)
  return ls

ls=[]
primes=eratosthenes(n)
for prime in primes:
  power=prime
  exp=0
  while n >= power:
    exp+=n//power
    
    power*=prime
  ls.append(exp)

mul=1
for i in ls:
  mul*=(i+1)
print(mul%mod)

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

def primes(n):
    from math import sqrt
    p = [1] * (n + 1)
    for x in range(2, int(sqrt(n)) + 1):
        if p[x]:
            p[x * 2:n + 1:x] = [0] * ((n - x) // x)
    return (i for i in range(2, n + 1) if p[i])

prime_numbers = list(primes(1000))

from collections import defaultdict

cs = defaultdict(int)

for x in range(1, N + 1):
    for n in prime_numbers:
        while x % n == 0:
            cs[n] += 1
            x //= n

result = 1

MOD = 10**9 + 7

for x in cs.values():
    result = result * (x + 1) % MOD

print(result)

Solution (Python):
from math import sqrt

MOD = 10 ** 9 + 7


def primes(N):
    p = [True] * (N + 1)
    p[0] = p[1] = False
    for i in range(2, int(sqrt(N)) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i, x in enumerate(p) if x]



N = int(input())
P = primes(N)

factors = []

for p in P:
    i = p
    f = 0
    while i <= N:
        f += N // i
        i *= p
    factors.append(f)

ans = 1

for f in factors:
    ans *= f + 1
    ans %= MOD

print(ans)

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

def trial_division(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

D = {}

for i in range(1,N+1) :
    for d in trial_division(i) :
        if d not in D :
            D[d] = 1
        else :
            D[d] += 1

ans = 1

for d in D :
    ans *= (D[d]+1)
    ans %= 10**9+7

print(ans)

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

import math
FACT=dict()

for x in range(1,N+1):
    L=int(math.sqrt(x))



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

    if x!=1:
        FACT[x]=FACT.get(x,0)+1

ANS=1
for j in FACT.values():
    ANS=ANS*(j+1)%mod

print(ANS)

Solution (Python):
from collections import Counter


def f(N):
    d = []
    i = 2
    while N > 1:
        if N % i == 0:
            d.append(i)
            N //= i
        else:
            i += 1
    return d

def solve(N):
    c = Counter()
    for k in range(2, N + 1):
        c.update(f(k))
    ans = 1
    P = 10 ** 9 + 7
    for count in c.values():
        ans *= (count + 1)
        ans %= P
    return ans


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

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

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

p_dict={}
for i in range(2,n+1):
    facts=factorize(i)
    for p in facts:
        if p not in p_dict:
            p_dict[p]=1
        else:
            p_dict[p]+=1
ans=1
for i in p_dict.values():
    ans=(ans*(i+1))%mod
print(ans)

Solution (Python):
def factorize(n):
    
    if n < 1:
        raise Exception('Invalid input: n = {}'.format(n))
    i = 2
    ret = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            ret.append(i)
        i += 1
    if n > 1:
        ret.append(n)
    return ret

N = int(input())
d = {}
for i in range(2, N+1):
    facts = factorize(i)
    for f in facts:
        if f not in d:
            d[f] = 1
        else:
            d[f] += 1
cnt = 1
for v in d.values():
    cnt = (cnt * (v+1)) % (10**9+7)
print(cnt)

Solution (Python):
import math


def Primes(n):
    Prime = []
    Table = list(range(2, n))
    for k in range(2, int(math.sqrt(n-1))+1):
        if k == Table[0]:
            Prime.append(Table[0])
            Table = [i for i in Table if i % k]
    return Prime + Table if n > 2 else []


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

for p in Primes(n+1):
    m = 0
    for k in range(2, n+1):
        for _ in range(10):
            if k % p == 0:
                m += 1
                k = k // p
            else:
                break
    ans *= 1+m
print(ans % mod)

Solution (Python):
import math


def Primes(n):
    if n > 2:
        Prime = []
        Table = list(range(2, n))
        for k in range(2, int(math.sqrt(n-1))+1):
            if k == Table[0]:
                Prime.append(Table[0])
                Table = [i for i in Table if i % k]
        return Prime + Table
    else:
        return []


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

for p in Primes(n+1):
    m = 0
    for k in range(2, n+1):
        for _ in range(10):
            if k % p == 0:
                m += 1
                k = k // p
            else:
                break
    ans = (ans*((1+m) % mod)) % mod

print(ans)

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

def f(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                    pf[j] = pf.get(j, 0) + 1
                    i //= j
    return pf

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

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

def nprf(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                if not j in pf:
                    pf[j] = 0
                pf[j] += 1
                i //= j
    return pf
    
cnt = 1
for v in nprf(n).values():
    cnt *= (v + 1)
    
print(cnt % mod)

Solution (Python):
n = int(input())
lis = [i for i in range(n + 1)]
cnt = [0 for i in range(n + 1)]
for i in range(2, n + 1):
    for j in range(i, n + 1, i):
        while lis[j] % i == 0:
            cnt[i] += 1
            lis[j] //= i
ans = 1
for i in cnt:
    ans = ans * (i + 1) % 1000000007
print(ans)

Solution (Python):
from collections import defaultdict

MOD = 1000000007

def primes(x):
    n = x
    for i in range(2, n + 1):
        if x == 1:
            return
        while x % i == 0:
            x //= i
            counter[i] += 1


if __name__ == '__main__':
    n = int(input())
    counter = defaultdict(int)
    for i in range(2, n + 1):
        primes(i)

    ans = 1
    for x in counter.values():
        ans *= x + 1
        ans %= MOD

    print(ans)

Solution (Python):
import math
N = 100000
prime = [True]*(N+1)
prime[0] = prime[1] = False
for i in range(N+1):
    if prime[i]:
        for j in range(2*i, N+1, i):
            prime[j] = False

n = int(input())
f = math.factorial(n)
res = 1

i = 2
while f!=1:
    if prime[i]:
        cc = 1
        while f%i==0:
            f=f//i
            cc+=1
        res*=cc
    i+=1
print(res%1000000007)

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

pndic= {2:0}
for L in range(3,N+1):
    chk = True
    for L2 in pndic.keys():
        if L%L2 == 0: chk = False
    if chk: pndic[L] = 0

for i in range(1,N+1):
    for p in pndic.keys():
        tmp = 0
        while i % p == 0:
            i //= p
            tmp += 1
        pndic[p] += tmp

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

print(ans)

Solution (Python):


import sys
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def SI(): return input()


n = I()

prime_cnt = defaultdict(int)
for num in range(2, n + 1):
    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        
        prime_cnt[num] += 1

ans = 1
for v in prime_cnt.values():
    ans *= v + 1
    ans %= MOD

print(ans)

Solution (Python):

import math
N = int(input())
dict_count = {}
for i in range(1,N+1):
    dict_count[i] = 0

def factoring(n):
    sup = math.floor(pow(n,1/2))
    n_new = n
    for i in range(2,sup + 1):
        if n % i == 0:
            n_new = n // i
            dict_count[i] += 1
            break
    if n == n_new:
        dict_count[n_new] += 1
        return
    return factoring(n_new)

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

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

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

N = int(input())
e = [0 for _ in range(N + 1)]

for x in range(2, N + 1):
    for p in range(2, x + 1):
        while x % p == 0:
            x //= p
            e[p] += 1

a = tuple(filter(lambda v: v > 0, e))

t = 1
for aa in a:
    t *= (aa + 1)
    t %= MOD
print(t)

Solution (Python):
def get_prime_factorized(N):
    R = []
    b, e = 2, 0
    while b ** 2 <= N:
        while N % b == 0:
            N  = N // b
            e += 1
        if e > 0:
            R.append([b, e])
        b, e = b + 1, 0
    if N > 1:
        R.append([N, 1])
    return R


N = int(input())
H = {}
R = 1

for n in range(1, N+1):
    for l in get_prime_factorized(n):
        k, c = l
        if k in H.keys():
            H[k] += c
        else:
            H[k]  = c

for k in H.keys():
    R *= (H[k]+1)
    R %= 10**9+7

print(R)

Solution (Python):
def primes_eratosthenes(n:int) -> list:
    isprime = [True] * (n+1)
    isprime[0] = isprime[1] = False

    for i in range(2, n+1):
        if isprime[i]:
            j = i + i
            while j <= n:
                isprime[j] = False
                j += i
    return [i for i in range(2,n+1) if isprime[i]]


def add_factor(d: dict, n: int, primes: list) -> dict:
    for p in primes:
        while n%p == 0:
            n /= p
            d[p] = d.get(p, 0) + 1
        if n==1:
            break
    return d 


def solve(n):
    primes = primes_eratosthenes(n)

    d = {}

    for i in range(2,n+1):
        d = add_factor(d, i, primes)

    MOD = 10**9 + 7
    ans = 1
    for v in d.values():
        ans = ans * (v+1) % MOD
    
    return ans
    

def main():
    n = int(input())
    ans = solve(n)
    print(ans)


main()

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

Solution (Python):
import math

def prime(n):
    prime_list = list(range(1, n + 1))
    for n_ in range(2, int(math.sqrt(n)) + 1):
        for p in prime_list:
            if p % n_ == 0 and p != n_:
                prime_list.remove(p)
    return prime_list


N = int(input())
p_list = prime(N)
prime_num = []

for _ in range(len(p_list)):
    prime_num.append(0)

for i in range(2, N+1):
    for j in range(1, len(p_list)):
        while i % p_list[j] == 0:
            prime_num[j] += 1
            i /= p_list[j]

ans = 1
for n in prime_num:
    ans = ans * (n + 1) % (10**9 + 7)
print(ans)

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

prime_table = [1] * (N+1)

for x in range(2, N+1):
    for t in range(2, x+1):
        while x % t == 0:
            prime_table[t] += 1
            x //= t
print(reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table))

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

F = [True]*(N+1)
F[0]=F[1]=False
P = []

for i in range(2,N+1):
    if F[i]==True:
        P.append(i)
        for j in range(i*2,N+1,i):
            F[j]=False

dic = defaultdict(int)
for i in range(2,N+1):
    for p in P:
        while i%p==0:
            dic[p] += 1
            i = i//p
        if i==1:
            break

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

print(ans)

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

def prime_table(n):
  list = [True for _ in range(n + 1)]
  i = 2
  while i * i <= n:
    if list[i]:
      j = i + i
      while j <= n:
        list[j] = False
        j += i
    i += 1

  table = [i for i in range(n + 1) if list[i] and i >= 2]
  return table

prime_table = prime_table(n)
ans = 1

for p in prime_table:
    count = 0
    for i in range(2,n+1):
        while i%p == 0:
            i /= p
            count += 1
    ans *= count+1

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

Solution (Python):
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 d(n):
    l=factorize(n)
    r=1
    for i,j in l:
        r*=int(j)+1
    return r
ans=0

import math
ans=d(math.factorial(n))%1000000007

print(ans)

Solution (Python):
N = int(input())
mod = 10**9+7
arr = [1 for i in range(N+1)]
for i in range(2,N+1):
    if arr[i] > 0:
        j = 2*i
        while(j<N+1):
            arr[j] = 0
            j += i
prime = []
for i in range(2,N+1):
    if arr[i] != 0:
        prime.append(i)
count = 1
for n in prime:
    tmp = n
    i = 0
    while(tmp < N+1):
        i += N//tmp
        tmp *= n
    count *= (i+1)
print(count%mod)

Solution (Python):
N=int(input())
num=1
factors=[]
for i in range(N,1,-1):
    num*=i

r=2
while num!=1:
    x=0
    while num%r==0:
        num//=r
        x+=1
    if x:
        factors.append(x)
    r+=1

result=1
for i in factors:
    result*=i+1

print(result%1000000007)

Solution (Python):
const = 10 ** 9 + 7
N = int(input())
TABLE = [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]
T = []
ans = 1
for x in TABLE:
    L = []
    for i in range(1,N + 1):
        count = 0
        while i % x == 0:
            i /= x
            count += 1
        L.append(count)
    T.append(sum(L)+1)

for x in T:
    ans *= x
print(ans % const)

Solution (Python):
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        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]]
n = int(input())
prime = primes(n)
a = [1]*n
for i in range(1,n+1):
    for p in prime:
        while i%p == 0:
            i = i//p
            a[p-1] += 1
ans = 1
for i in a:
    ans *= i
mod = 10**9 + 7
print(ans%mod)

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

Solution (Python):
n = int(input())
prime = [2]
for i in range(3, n+1):
	if all(i % x for x in prime):
		prime.append(i)
ans = 1
p = 1000000007
for x in prime:
	a = n
	cnt = 0
	while(a!=0):
		cnt += a//x
		a //= x
	ans = ans * (cnt+1) % p
print(ans)

Solution (Python):
n = int(input())
l = []
ans = 1
for i in range(2,n+1):
    for j in range(2,i):
        if i % j == 0:
            break
    else:
        l.append(i)

for h in l:
    a = 1
    for i in range(1,n+1):
        while i % h == 0:
            i /= h
            a += 1
    else:
        ans *= a

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

Solution (Python):
from math import factorial

N = int(input())
N = factorial(N)

i = 2
num = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        num += 1
    else:
        i += 1
        ans *= num
        num = 1
print(ans * num % (10**9 + 7))

Solution (Python):
def main():
    primes = [2]
    for x in range(3, 1000, 2):
        if any(map(lambda p: x % p == 0, primes)):
            continue
        primes.append(x)

    powers = dict()
    for p in primes:
        powers[p] = 0

    n = int(input())
    for i in range(2, n + 1):
        for p in primes:
            if p > i:
                break
            ii = i
            while ii % p == 0:
                ii //= p
                powers[p] += 1

    res = 1
    for power in powers.values():
        res = (res * (power + 1)) % 1000000007
    print(res)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
p = 10**9 + 7
m = [2]
for i in range(n+1):
    for j in range(2, i):
        if i % j == 0:
            break
        if j == i-1:
            m.append(i)

a = [0]*len(m)

for i in range(1, n+1):
    for j in range(len(m)):
        while i % m[j] == 0:
            a[j] += 1
            i //= m[j]
ans = 1
for i in a:
    ans *= (i+1) % p
print(ans%p)

Solution (Python):


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

N = int(input())

p = [0]*(N+1)

for i in range(2, N+1):
    for j in range(2, i+1):
        if is_prime(j) == False:
            continue
        while i%j==0:
            i //= j
            p[j] += 1
        if i == 1:
            break

r = 1
for q in p:
    r = r * (q+1)
print(r%(10**9+7))

Solution (Python):
import math
from collections import defaultdict

n = int(input())
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def primes(x):
    if x < 2: return []

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

    
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
pr = primes(n + 1)
q = math.factorial(n)
di = {}
di = defaultdict(int)
for i in pr:
    while q % i == 0:
        q = q // i
        di[i] += 1

ans = 1
mod = 10 ** 9 + 7
for i in di:
    ans *= di[i] + 1
    ans %= mod
print(ans)

Solution (Python):
N = int(input())
p = 10 ** 9 + 7
primes = []
for i in range(1, N + 1):
  for j, prime in enumerate(primes):
    while i % prime[0] == 0:
      primes[j][1] += 1
      i //= prime[0]
    if i < prime[0]:
      break
  if i > 1:
    primes.append([i, 2])
ans = 1
for k, v in primes:
  ans *= v
  ans %= p
print(ans)

Solution (Python):
def c_factors_of_factorial(N):
    import math

    def prime_decomposition(n):
        
        from collections import defaultdict
        i = 2
        table = defaultdict(int)
        while i**2 <= n:
            while n % i == 0:
                n //= i
                table[i] += 1
            i += 1
        if n > 1:
            table[n] += 1
        return table

    exp_list = prime_decomposition(math.factorial(N))
    ans = 1
    for v in exp_list.values():
        ans = (ans * (v + 1)) % (10**9 + 7)
    return ans

N = int(input())
print(c_factors_of_factorial(N))

Solution (Python):
def c_factors_of_factorial(N):
    def exponential_list(n):
        
        ret = {}
        for j in range(2, n + 1):
            current = j
            ret[j] = 0
            for k in range(2, j + 1):
                while current % k == 0:
                    ret[k] += 1
                    current //= k
            if ret[j] == 0:
                ret.pop(j)
        return ret

    exp_list = exponential_list(N)
    ans = 1
    for e in exp_list.values():
        ans *= e + 1
        ans %= 10**9 + 7
    return ans

N = int(input())
print(c_factors_of_factorial(N))

Solution (Python):
N = int(input())
MOD = int(1e+9) + 7



prime = [2]

for i in range(2, 1001):
    for j in range(2,i-1):
        if i % j == 0:
            break

    else:
        prime.append(i)

factor = [1] * 1001


for i in range(1, N+1):
    for p in prime:
        if i == 1:
            break
        while i % p == 0:
            i /= p
            factor[p] += 1

ans = 1
for fact in factor:
    ans *= fact
    ans %= MOD

print(ans)

Solution (Python):

N = int(input())

tab = [0] * (N + 1)

for i in range(2, N + 1):
    i_tmp = i
    for p in range(2, N + 1):
        if p < 2: break
        elif i_tmp % p > 0: continue
        for j_p in range(1, 32 + 1):
            if i_tmp % (p ** (j_p + 1)) > 0: break
        i_tmp = i_tmp // (p ** j_p)
        tab[p] += j_p



ans = 1
for tab_i in tab:
    if tab_i < 1: continue
    else: ans = (ans * (tab_i + 1)) % (10 ** 9 + 7)

print(ans)

Solution (Python):
N = int(input())
num = 1
factors = []

for i in range(N, 1, -1):
    num *= i

r = 2
while num != 1:
    x = 0
    while num % r == 0:
        num //= r
        x += 1
    if x:
        factors.append(x)
    r += 1

result = 1
for i in factors:
    result *= i+1

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

Solution (Python):
N = int(input())
mod = 10**9+7
fact = {}
for j in range(2, N+1):
    for i in range(2, j+1):
        while j % i == 0:
            if i in fact.keys():
                fact[i] += 1
            else:
                fact[i] = 2
            j //= i
ans = 1
for v in fact.values():
    ans *= v
    ans %= mod
print(ans)

Solution (Python):


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 divisorize(fct):
    b, e = fct.pop()  
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base ** exponent
    return a




def divisorEnumulation(n):
    divisor = []
    for div in divisorize(factorize(n)):
        divisor.append(num(div))
    return divisor


n = int(input())

fact = [0 for i in range(10 ** 3 + 1)]
for i in range(2, n+1):
    tmpFact = factorize(i)
    for div in tmpFact:
        fact[div[0]] += div[1]
out = 1
for _fact in fact:
    
    out *= _fact + 1
    out %= 10**9+7
print(out % (10 ** 9 + 7))

Solution (Python):
from math import factorial

N = factorial(int(input()))

i = 2
check = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        check += 1
    else:
        ans *= check
        check = 1
        i += 1
print((ans*check)%(10**9+7))

Solution (Python):
n=int(input())
l=[0]*n
for i in range(1,n+1):
    b=2
    while b<=i:
        while i%b==0:
            i//=b
            l[b-1]+=1
        b+=1

x=1
for i in l:
    if i!=0:
        x=x*(i+1)%(10**9+7)
print(x)

Solution (Python):

n=int(input())
l=[0]*n

for i in range(1,n+1):
    b=2
    while b <= i:
        while i%b==0:
            i = i//b
            l[b-1]+=1
        b+=1
x=1
for i in l:
    if i != 0:
        x=x*(i+1)%(10**9+7)
print(x)

Solution (Python):
import math
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


n = int(input())
n_fra = math.factorial(n)
p_f = prime_factorize(n_fra)
count = 1

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

Solution (Python):
import math


def combination(n, r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


N = int(input())
ans = N

m = {}
for i in range(2, N+1):
    for _i in range(2, i+1):
        if i % _i == 0:
            m.setdefault(i, 0)
            if not(is_prime(_i)):
                continue
            a = i
            b = _i
            while(True):
                m[_i] += 1
                n = a//b
                if n % _i != 0:
                    break
                a = n

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