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())
outlist = [0 for i in range(n+1)]

def isprime(n):
  for i in range(2, int(math.sqrt(n)+1)):
    if n%i == 0:
      return (0)
      break
  return (1)
    
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 

for i in range(2,n+1):
  L = factorization(i)
  for j in range(len(L)):
    if isprime(L[j][0]) == 1:
      outlist[L[j][0]] += L[j][1]

out = 1
for i in range(len(outlist)):
  out = out * (outlist[i]+1)
print(out % (pow(10,9)+7))

Solution (Python):
from collections import defaultdict

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

d = defaultdict(int)
for i in range(1, N + 1):
    for j in range(2, int(i ** 0.5) + 1):
        while i % j == 0:
            d[j] += 1
            i //= j
    if i > 1:
        d[i] += 1
ans = 1
for i in d.values():
    ans *= (i + 1)
    ans %= INF

print(ans)

Solution (Python):
def fact(i):
    global d
    k=0
    while i%2==0:
        i//=2;k+=1
    d[2]+=k
    for p in range(3,33,2):
        k=0
        while i%p==0:
            i//=p;k+=1
        d[p]+=k
    if i>1:
        d[i]+=1

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

N=int(input())
d=defaultdict(int)

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

ans=1
for k in d.values():
    ans=(ans*(k+1))%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 += 1
        if e > 0:
            fct.append((b,e))
        b,e = b+1,0
    if n > 1:
        fct.append((n,1))
    return fct

n = int(input())

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):
from collections import Counter

def prime_factrization(n):
    a=[]
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            n//=i
            a.append(i)
    if a==[]:
        a.append(n)
    else:
        if n!=1:
            a.append(n)
    return a
    
n=int(input())
if n==1:
    print(1%1000000007)
else:
    L=[]
    for i in range(2,n+1):
        L+=prime_factrization(i)
    LC=Counter(L)
    r=1
    for v in LC.values():
        r*=(v+1)
    print(r%1000000007)

Solution (Python):
import collections
import math

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

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

c=collections.Counter(prime_factorize(N))
L=list(c.values())
L=[i+1 for i in L]
ans=1
for i in L:
    ans=ans*i%MOD
print(ans)

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

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



a=int(input())
y=[]
x=1
for i in range(1,a+1):
    y=y+(prime_factorize(i))
    
y.sort()
c = collections.Counter(y)
c = c.most_common()

for i in range(len(c)):
    x*=c[i][1]+1
    x=x%mod
print(x)

Solution (Python):
INF = 1e9 +7

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

n = int(input())
a = 1
for i in range(1,n+1):
    a *=i
b = factorize(a)
m = len(b)
ans = 1
for i in range(m):
    ans = ans*(b[i][1]+1)
    ans = ans%INF
    ans = int(ans)
print(ans)

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


def fac(n):
    att = []
    t = n
    for i in range(2, int(-(-n ** 0.5 // 1) + 1)):
        c = 0
        while (t % i == 0):
            c += 1
            t //= i
        if c:
            att += [[i, c]]
    if t != 1:
        att += [[t, 1]]
    if att == []:
        att += [[n, 1]]
    return att


MOD = 10 ** 9 + 7
t = 1
memo = {}
for i in range(2, N + 1):
    fl = fac(i)
    for f in fl:
        if f[0] in memo:
            memo[f[0]] += f[1]
        else:
            memo[f[0]] = f[1]
for m in memo:
    t = (t * (memo[m] + 1)) % MOD
t %= MOD
print(t)

Solution (Python):
INF = int(1e9+7)


def primeNumber(n, pn):
    
    b = [True] * (n + 1)
    for i in range(2, n + 1):
        if b[i]:
            pn.append(i)
            for j in range(i, n + 1, i):
                b[j] = False
    return


def main():
    N = int(input())
    pn = []
    primeNumber(N, pn)
    ans = 1
    for p in pn:
        cnt = 0
        cum = p
        while cum <= N:
            cnt += N // cum
            cum *= p
        ans = ans * (cnt + 1) % INF
    print(ans)


main()

Solution (Python):
N = int(input())
mod = 10**9+7
ans = 1
num = [0]*N
for i in range(1,N+1):
    for j in range(2,i+1):
        while i % j == 0:
            i //= j
            num[j-1] += 1
for i in range(N):
    if num[i] == 0:
        continue
    else:
        ans = ans * (num[i]+1) % mod
print(ans)

Solution (Python):
import math
mod = int(1e9+7)

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

count_of_prime_factors = {}
while True:
    if n > 1:
        count = 0
        while n % 2 == 0:
            n //= 2
            count += 1
        if count != 0:
            count_of_prime_factors.update({2: count})
        if n == 1: 
            break 

        for i in range(3, N+1, 2):
            count = 0
            while n % i == 0:
                n //= i 
                count += 1
            if count != 0:
                count_of_prime_factors.update({i: count})
            if n == 1: 
                break
        else:        
            count_of_prime_factors.update({n: 1})
        break 
    else:
        print(1)
        exit()

ans = 1
for prime_factor, count in count_of_prime_factors.items():
    ans *= count + 1

print(ans % mod)

Solution (Python):
import math
mod = int(1e9+7)

N = int(input())

factorial_of_n = math.factorial(N)

def countOfPrimeFactors(n):
    
    
    count_of_prime_factors = {}
    if n > 1:
        count = 0
        while n % 2 == 0:
            n //= 2
            count += 1
        if count != 0:
            count_of_prime_factors.update({2: count})
        if n == 1: 
            return count_of_prime_factors 

        for i in range(3, n, 2):
            count = 0
            while n % i == 0:
                n //= i 
                count += 1
            if count != 0:
                count_of_prime_factors.update({i: count})
            if n == 1: 
                return count_of_prime_factors 
              
        count_of_prime_factors.update({n: 1})
        return count_of_prime_factors 
    else:
        return {}

ans = 1
for prime_factor, count in countOfPrimeFactors(factorial_of_n).items():
    ans *= count + 1

print(ans % mod)

Solution (Python):
def primeFactorize(n):
    if n > 1:
        prime_factors = []
        while n % 2 == 0:
            n //= 2 
            
            
            
            prime_factors.append(2)
        
        
        
        for i in range(3, int(n**0.5)+1, 2):
            while n % i == 0:
                n //= i 
                prime_factors.append(i)
            if n == 1: 
                return prime_factors
        
        
        
        prime_factors.append(n)
        return prime_factors
    else:
        return []


def findPrimeNumbers(n):
    
    prime_numbers = [2]
    for i in range(3, n+1, 2):

        for j in prime_numbers:
            if i % j == 0:
                break
        else:
            prime_numbers.append(i)

    return prime_numbers

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

prime_factors_of_the_factorial_of_n = []
for i in range(1, N+1):
    prime_factors_of_the_factorial_of_n += primeFactorize(i)

count_of_each_prime_number = []
for i in findPrimeNumbers(N):
    count_of_each_prime_number.append(
        prime_factors_of_the_factorial_of_n.count(i)
    )


ans = 1
for c in count_of_each_prime_number:
    ans *= c + 1

print(ans % mod)

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    
    val = math.factorial(N)
    
    divisors = factorize(val)
    
    
    ans = 1
    for i in divisors:
        
        a,b = i
        ans = ans * (b+1)
        ans = ans % 1000000007
        
    print(ans)
    
    
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
    
if __name__ == "__main__":
	main()

Solution (Python):
from functools import reduce
INF = int(1e9+7)


def primeFactor(n, pf):
    
    if n == 1:
        return
    f = 2
    while (f * f <= n):
        if (n % f == 0):
            pf[f] += 1
            n = n // f
        else:
            f += 1
    pf[n] += 1


def main():
    N = int(input())
    pf = [0] * (N + 1)
    for i in range(1, N + 1):
        primeFactor(i, pf)
    print(reduce(lambda x, y : x * (y + 1) % INF, pf, 1))
    return


main()

Solution (Python):
from collections import defaultdict
from functools import reduce
INF = int(1e9+7)


def primeFactor(n, pf):
    
    if n == 1:
        return
    f = 2
    while (f * f <= n):
        if (n % f == 0):
            pf[f] += 1
            n = n // f
        else:
            f += 1
    pf[n] += 1


def main():
    N = int(input())
    d = defaultdict(lambda: 0)
    for i in range(1, N + 1):
        primeFactor(i, d)
    print(reduce(lambda x, y : x * (y + 1) % INF, d.values(), 1))
    return


main()

Solution (Python):
from collections import defaultdict
INF = int(1e9+7)


def primeFactor(n, pf):
    
    if n == 1:
        return
    f = 2
    while (f * f <= n):
        if (n % f == 0):
            pf[f] += 1
            n = n // f
        else:
            f += 1
    pf[n] += 1


def main():
    N = int(input())
    d = defaultdict(lambda: 0)
    for i in range(1, N + 1):
        primeFactor(i, d)
    ans = 1
    for i in d.values():
        ans *= i + 1
        ans %= INF
    print(ans)
    return


main()

Solution (Python):
from collections import defaultdict

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())
d = defaultdict(int)

for i in range(2,n+1):
  F = factorization(i)
  for j in F:
    d[j[0]] += j[1]
    
ans = 1
for v in d.values():
  ans *= v+1
  ans %= 1000000007
  
print(ans%1000000007)

Solution (Python):
P = [1 for _ in range(1000)]
P[0] = 0
P[1] = 0
for i in range(2,int(1000**0.5)+1):
    for j in range(i*i,1000,i):
        P[j] = 0
Q = []
for i in range(1000):
    if P[i]==1:
        Q.append(i)
INFTY = 10**9+7
N = int(input())
F = {q:0 for q in Q}
for i in range(2,N+1):
    for q in Q:
        while True:
            if i%q==0:
                F[q] += 1
                i = i//q
            else:break
prod = 1
for q in F:
    prod = (prod*(F[q]+1))%INFTY
print(prod)

Solution (Python):

import sys
import math
MOD = 1000000007  
from collections import Counter
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def solve(N: int):
    soinsuu = prime_decomposition(math.factorial(N))
    counter = Counter(soinsuu)
    answer =1
    for value in counter.values():
        answer = answer*(value+1)
    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
import math
from collections import defaultdict


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

    
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

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


num = int(input())
div_sum = defaultdict(int)

p = make_prime_list(num)
for j in range(2, num+1):

    div_num = defaultdict(int)

    for i in p:
        n = j
        while n % i == 0:
            div_num[i] += 1
            n //= i

    for k, v in div_num.items():
        div_sum[k] += v

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

Solution (Python):
n = int(input())
mod = 7 + 10 ** 9
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]]

P = primes(n)
primes_count = {}
for i in P:
    primes_count[i] = 0
prime_index = 0
for i in range(2,n+1):
    prime_index = 0
    while i > 1:
        if i % P[prime_index] == 0:
            i = i // P[prime_index]
            primes_count[P[prime_index]] += 1
        else:
            prime_index += 1
ans = 1
for i in primes_count.keys():
    ans *= (primes_count[i] + 1)
print(ans % mod)

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

e=[0]*(n+1)
def soinsu(n,e):
    for i in range(2,n+1):
        cur=i
        for j in range(2,i+1):
            while cur%j==0:
                e[j]+=1
                cur//=j
soinsu(n,e)
ans=1
for i in range(n+1):
    ans*=(e[i]+1)
    ans%=(10**9+7)
print(ans)

Solution (Python):
from math import factorial

n=int(input())
fcr=[]
for i in range(1,n+1):
    p=2
    while p*p<=i:
        while i%p==0:
            fcr.append(p)
            i//=p
        p+=1
    if i>1:
        fcr.append(i)
ans=1
s_fcr=set(fcr)
for i in s_fcr:
    ans*=fcr.count(i)+1
print(ans%(10**9+7))

Solution (Python):
import math
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
mod = 10**9 + 7
N = int(input())
N = math.factorial(N)
div = factorize(N)
setdiv = set(div)
ans = 1
for d in setdiv:
    ans *= div.count(d) + 1
print(ans%mod)

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

mod=10**9+7
m=math.factorial(n)
ans=1
for i in range(2,n+1):
  tmp=1
  while m%i==0:
    m=m//i
    tmp+=1
  ans*=tmp
print(ans%mod)

Solution (Python):
plist = [2]
for i in range(3, 1001, 2):
    tmp = 0
    for j in range(3, i+1, 2):
        if i % j == 0:
            tmp = j
            break
    if tmp == i:
        plist.append(i)

n = int(input())
tmp = [1] * len(plist)
for i in range(1, n+1):
    for j, p in enumerate(plist):
        i_tmp = i
        while(i_tmp % p == 0):
            i_tmp /= p
            tmp[j] += 1

ret = 1
for i in tmp:
    ret *= i
print(ret % (10**9+7))

Solution (Python):
n=int(input())
MOD=10**9+7 
def isp(i):
    if i<=1:
        return 0 
    return all(i%j for j in range(2,int(i**0.5)+1))
ans=1 
def po(x,n):
    c=0 
    while n//x:
        c+=n//x 
        n//=x 
    return c 
for i in range(2,n+1):
    if isp(i): 
        p=po(i,n)
        ans*=(p+1)
        ans%=MOD 
print(ans)

Solution (Python):


import collections

N = int(input())


def prime_set(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5) + 1):
        primes.difference_update(range(i*2, n+1, i))
    return primes


def prime_factors(n):
    f = []
    for i in prime_set(int(n**0.5) + 1):
        while n % i == 0:
            f.append(i)
            n //= i
    if n > 1:
        f.append(n)
    return f

N_factorial_prime_factors = []
for i in range(1, N+1):
    N_factorial_prime_factors.extend(prime_factors(i))
    
N_factorial_prime_factors = collections.Counter(N_factorial_prime_factors)
ans = 1
for x in N_factorial_prime_factors.values():
    ans *= x + 1
    ans %= 10**9 + 7
    
print(ans)

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

def pf(x,dic):
    done = set()
    for i in range(2,x+1):
        if i in done:
            continue
        if x%i==0:
            count =1
            done.add(i)
            while (count+1)*i<=x:
                count +=1
                done.add(count*i)
            count = 1
            while x%(i**(count+1))==0:
                count +=1
                
            if i in dic:
                dic[i] +=count
            else:
                dic[i] =count

for j in range(2,n+1):
    pf(j,dic)
ans = 1
for value in dic.values():
    ans = ans*(1+value)%mod
print(ans)

Solution (Python):
N = int(input())
mod = 10**9 + 7
cnt = {}
def yakusuu(p,dict):
  while True :
    if p == 1 :
      break  
    for i in range(2,p+1):
      if p % i == 0:
        if i not in dict:
          dict[i] = 1
          return yakusuu(p//i,dict)
        else:
          dict[i] += 1 
          return yakusuu(p//i,dict)

for i in range(2,N+1):
  yakusuu(i,cnt)
ans = 1 
for i, j in cnt.items():
  ans *= (j + 1) 
  ans = ans % mod
print(ans)

Solution (Python):
import collections
import itertools
import functools
import math

s = set([])
if __name__ == "__main__":
    n = int(input())
    m = math.factorial(n)
    res = 1
    for j in range(2, n + 1):
        tmp = 1
        while m % j == 0:
            m = m//j
            tmp += 1
        res *= tmp
    print(res % (10**9 + 7))

Solution (Python):
n=int(input())
if n==1:
  print("1")
else:
  import numpy as np
  
  def seachPrimeNum(N):
      max = int(np.sqrt(N))
      seachList = [i for i in range(2,N+1)]
      primeNum = []
      while seachList[0] <= max:
          primeNum.append(seachList[0])
          tmp = seachList[0]
          seachList = [i for i in seachList if i % tmp != 0]
      primeNum.extend(seachList)
      return primeNum
    
  f=len(seachPrimeNum(n))
  g=seachPrimeNum(n)
  c=1
  
  for j in range(f):
    e=g[j]
    a=0
    b=n
    h=0
    while b>=e:
      b=b//e
      h=h+b
      a=a+1
    c=c*(h+1)
  print(c%(10**9+7))

Solution (Python):
N=int(input())
M=1
ans=1
for i in range(N):
    M*=(i+1)
for k in range (2,N+1):
    u=1
    while M%k==0:
        M=M//k
        u+=1
    ans*=u
print(ans%(10**9+7))

Solution (Python):
def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val%w
print(cnt%w)

Solution (Python):
n=int(input())
ans=1
mod=10**9+7
m=1
for i in range(n):
    m*=(i+1)
for j in range(2,n+1):
    b=1
    while m%j==0:
        m=m//j
        b+=1
    ans*=b
ans=ans%mod
print(ans)

Solution (Python):
import math
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
def fact(n):
    arr = [[i,1] for i in range(2,n+1)]
    for i in range(2,n+1):
        for j in range(2,n+1):
            tmp=arr[j-2][0]
            if tmp%i==0 and tmp//i>1:
                while tmp%i==0:
                    arr[i-2][1]+=1
                    tmp //= i
                    arr[j-2][1]=0
    return arr
n=int(input())
x=fact(n)
cnt=1
for i in range(n-1):
    if is_prime(i+2):
        cnt*=x[i][1]+1
        cnt%=1000000007
print(cnt)

Solution (Python):
def kaijo(n):
    k=1
    for i in range(n):
        k*=i+1
    return k
def yaku(n):
    b=2
    l=[]
    while n>1:
        while n%b==0:
            l.append(b)
            n//=b
        b+=1
    ls=set(l)
    ans=[(i,l.count(i)) for i in ls]
    return ans
            

def resolve():
    n=int(input())
    l=yaku(kaijo(n))
    s=1
    for i in l:
        s*=i[1]+1
    print(s%(10**9+7))

resolve()

Solution (Python):
from math import sqrt


def prime_factorize(n):
    result = []
    for i in range(2, int(sqrt(n)) + 1):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


N = int(input())

t = [0] * (N + 1)
for i in range(2, N + 1):
    for p, c in prime_factorize(i):
        t[p] += c

result = 1
for i in range(2, N + 1):
    if t[i] == 0:
        continue
    result = result * (t[i] + 1) % 1000000007
print(result)

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())
l=[0]*(n+1)
for i in range(1,n+1):
    c=prime_factorize(i)
    
    for j in range(len(c)):
        l[c[j]]+=1

ans=1
for i in range(n+1):
    if l[i]!=0:
        ans=ans*(l[i]+1)%(10**9+7)
print(ans%(10**9+7))

Solution (Python):
n=int(input())
if n==1:
    print(1)
    exit()
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
so=[]
ka=[]
for i in range(2,n+1):
    a=factorization(i)
    for j in a:
        if not j[0] in so:
            so.append(j[0])
            ka.append(j[1])
        else:
            ka[so.index(j[0])]+=j[1]
ans=1
for i in ka:
    ans*=(i+1)%1000000007
print(ans%1000000007)

Solution (Python):
import collections
import functools
DIVISOR = 10 ** 9 + 7
n = int(input())

if n == 1:
    print(1)
else:
    prime_factor = collections.defaultdict(int)
    for i in range(1, n + 1):
        tmp = i
        for j in range(2, int(n ** 0.5) + 1):
            while tmp % j == 0:
                prime_factor[j] += 1
                tmp //= j

        if tmp > 1:
            prime_factor[tmp] += 1

    
    prime_factor_num = [prime_factor[key] + 1 for key in prime_factor]

    print((functools.reduce(lambda x, y: (x % DIVISOR) * y, prime_factor_num)) % DIVISOR)

Solution (Python):
import math
from collections import Counter


def prime_factrize(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())
ans = 1
mod = 10 ** 9 + 7

fact = math.factorial(N)
soinsuu = prime_factrize(fact)
c = Counter(soinsuu)

for i in c:
    ans *= (c[i] + 1)
print(ans % mod)

Solution (Python):
from math import factorial
from collections import Counter

n = factorial(int(input()))
res = []
x = n
y = 2
while y*y <= x:
    while x % y == 0:
        res.append(y)
        x //= y
    y += 1
if x > 1:
    res.append(x)

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

Solution (Python):
import math
n = int(input())
list_prime = [2]
for i in range(3, n + 1):
  for one_prime in list_prime:
    if i % one_prime == 0:
      break
  else:
    list_prime.append(i)

result = 1
for one_prime in list_prime:
  temp = 0
  for i in range(1, int(math.log(n, one_prime)) + 1):
    temp += n // (one_prime ** i)
  result = result * (temp + 1) % (7 + 10 ** 9)
print(result)

Solution (Python):
import math



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())
fact = prime_factorize(math.factorial(n))
before_x = 1
total = 1
count = 0
for i in range(len(fact)):
    if fact[i] == before_x:
        count += 1
    else:
        total *= (count + 1)
        count = 1
        before_x = fact[i]
    if i == len(fact) - 1:
        if fact[i] == before_x:
            total *= (count + 1)
        else:
            total *= 2
print(total % ((10**9) + 7))

Solution (Python):
n = int(input())
inf = 10**9 + 7
p = [True for i in range(n+1)]
ret = 1
for i in range(2, n+1):
    if not p[i]:
        continue
    for j in range(n//i + 1):
        p[i*j] = False
    j = 1
    cnt = 1
    while i**j <= n:
        cnt += n//(i**j)
        j += 1
    ret = (ret * cnt) % inf
print(ret)

Solution (Python):
from collections import defaultdict

MOD = 10**9 + 7
facts = defaultdict(int)


def factorize(n):
    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
                facts[i] += 1
    if temp != 1:
        facts[temp] += 1


N = int(input())
for x in range(1, N+1):
    factorize(x)

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

print(ans)

Solution (Python):
from collections import Counter

N = int(input())
divisor = []
mod = 10 ** 9 + 7


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


for i in range(N):
    divisor.extend(prime_factorize(i + 1))

c = list(Counter(divisor).values())
ans = 1

for i in c:
    ans = ans * (i + 1) % mod

print(ans)

Solution (Python):

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

def factorization(n):
    retlist = []
    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
            retlist.append([i, cnt])

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

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

    return retlist

G = []
H = [0]*(n+1)

for i in range(1,n+1):
    FRA = factorization(i)
    for fra in FRA:
        G.append(fra)

for i in range(len(G)):
    H[G[i][0]] += G[i][1]

H = [int(h)+1 for h in H]
ans = 1
for i in range(len(H)):
    if i >=2:
        ans *= H[i]
        ans %= mod
print(ans)

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

pf = {}
for i in range(2, N+1):
    for j in range(2, int(i**0.5)+1):
        while i % j == 0:
            pf[j] = pf.get(j, 0) + 1
            i //= j
    if i > 1:
        pf[i] = pf.get(i, 0) + 1

ans = 1
for p in pf.values():
    ans = ans * (p+1) % mod

print(ans)

Solution (Python):
def c_factors_of_factorial(MOD=10**9 + 7):
    from math import factorial as fac
    from functools import reduce
    from operator import mul
    from collections import defaultdict

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

    N = int(input())
    return reduce(mul, [v + 1 for v in prime_factorization(fac(N)).values()]) % MOD

print(c_factors_of_factorial())

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

pf = {}
for i in range(2, N + 1):
    for j in range(2, int(i**0.5) + 1):
        while i % j == 0:
            pf[j] = pf.get(j, 0) + 1
            i //= j
    if i > 1:
        pf[i] = pf.get(i, 0) + 1

ans = 1
for p in pf.values():
    ans = ans * (p + 1) % mod
print(ans)

Solution (Python):
import math

N=int(input())

num = math.factorial(N)
primeNum=[]

for i in range(2,1000):
  flag=False  
  for j in range(2,i):
    if i%j==0:
      flag=True
      break
  if flag==False:
    primeNum.append(i)
    



resulNum=[0]*len(primeNum)
result=1

j=0
flag=False
for i in primeNum:
  while num % i == 0 :
    num = num // i
    resulNum[j]+=1
    flag=True
  
  if flag==True:
    result*=(resulNum[j]+1)
    result %= 10**9+7
  j+=1
  flag=False

print(result)

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

shisuu = [0] * (N+1)

for i in range(2,N+1):
    x = i
    for j in range(2,N+1):
        while x%j == 0:
            x //= j
            shisuu[j] += 1
        
ans = 1
mod = 10**9+7

for s in shisuu:
    ans *= (s+1)
    ans %= mod

print(ans)

Solution (Python):
import collections
import math


def eratosthenes(n):
    sieve = [True for _ in range(n + 1)]
    sieve[0] = False
    sieve[1] = False

    def _update(p):
        if sieve[p]:
            for i in range(p * 2, n + 1, p):
                sieve[i] = False

    if n > 1:
        _update(2)
    p = 3
    while p * p <= n:
        _update(p)
        p += 2
    return sieve


n = int(input())
sieve = eratosthenes(math.ceil(math.sqrt(n)))
counter = collections.Counter()
for k in range(1, n + 1):
    for i in range(1, k):
        if i**2 > k:
            break
        if sieve[i]:
            while k % i == 0:
                counter[i] += 1
                k //= i
        if k == 1:
            break
    if k > 1:
        counter[k] += 1

MOD = 10**9 + 7
res = 1
for v in counter.values():
    res *= v + 1
print(res % MOD)

Solution (Python):


from collections import Counter
from math import factorial

n = int(input())


def prime_factorize(x):
    li = []

    while x % 2 == 0:
        li.append(2)
        x //= 2

    f = 3
    while f * f <= x:
        if x % f == 0:
            li.append(f)
            x //= f
        else:
            f += 2

    if x != 1:
        li.append(x)

    return li


fact = factorial(n)
li = prime_factorize(fact)
c = Counter(li)
ans = 1
mod = 10 ** 9 + 7
for v in c.values():
    ans *= v + 1
    ans %= mod

print(ans)