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

n = int(input())


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


factors = defaultdict(int)
for i in range(1, n + 1):
    ps = prime_factorize(i)
    for p in ps:
        factors[p] += 1

count = 1
for p, m in factors.items():
    count *= (1 + m)
    count %= 1000000007

print(count)

Solution (Python):
import collections

n = int(input())


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


k = []
for i in range(1, n + 1):
    k = k + prime_factorize_n(i)
c = collections.Counter(k)
d = c.most_common()
ans = 1

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

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

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

def make_divisors(n):
  divisors = []
  mod = 10**9 + 7
  s = (n**0.5)%mod
  for i in range(1, int(s)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

p = []
for i in range(1, n+1):
  p += prime_factorize(i)

import collections
pc = collections.Counter(p)

a = 1
for v, c in pc.items():
  a *= c+1

mod = 10**9 +7
print(a%mod)

Solution (Python):
N=int(input())
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

if N==1:
  print(1)
  exit()
else:
  D=[0]*(N+1)
  for i in range(2,N+1):
    A=factorization(i)
    for j in A:
      D[j[0]]+=j[1]
  ans=1
  for i in D:
    ans*=(i+1)
    ans%=10**9+7
  print(ans)

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

def factorize(n):
  cnt = Counter()

  for i in range(2, int(math.sqrt(n)) + 2):
    while n % i == 0:
      cnt[i] += 1
      n //= i

  if n > 1:
    cnt[n] += 1

  return cnt

cnts = []
for i in range(1, N+1):
  cnts.append(factorize(i))

base = Counter()
for c in cnts:
  for (key, value) in c.items():
    base[key] += value

ans = 1
for (key, value) in base.items():
  ans *= (1 + value)

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

Solution (Python):
def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

mod=10**9+7
n=int(input())
l=[]
for i in range(1,n+1):
 l+=factorization(i)

ans=1
for i in set(l):
 ans*=l.count(i)+1
print(ans%mod)

Solution (Python):
n=int(input())
def factorization(n):
  primen = []
  degree = []
  primend = []
  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
      primen.append(i)
      degree.append(cnt)
      primend.append([i,cnt])
  if temp!=1:
    primen.append(temp)
    degree.append(1)
    primend.append([temp,1])
  if primen==[]:
    primen.append(n)
    degree.append(1)
    primend.append([n,1])
  return primend
pn=[0]*(n+1)
for i in range(1,n+1):
  for j in factorization(i):
    pn[j[0]]+=j[1]
ans = 1
for k in range(2,n+1):
  ans*=(pn[k]+1)%(10**9+7)
print(ans%(10**9+7))

Solution (Python):

import math
n = int(input())

def eratosthenes(n):
    prime = [2]
    for i in range(2,n+1):
        for j in range(2,math.ceil(i**1/2)+1):
            if i % j == 0: break
            if j == math.ceil(i**1/2): 
                prime.append(i)
    return prime
prime = eratosthenes(n)


ans = 1
for i in prime:
    div = i
    cnt_div = 0
    while div <= n:
        cnt_div += n // div
        div *= i

    
    ans = ans * (1+cnt_div) % (10**9+7)
print(ans%(10**9+7))

Solution (Python):
from collections import defaultdict

N = int(input())
factors = defaultdict(int)
for n in range(2, N+1):
    for i in range(2,int(n**.5)+1):
        while n % i == 0:
            n //= i
            factors[i] += 1
    if n > 1:
        factors[n] += 1

ans = 1
for c in factors.values():
    ans *= c + 1
    ans %= 1000000007
print(ans)

Solution (Python):
from collections import defaultdict
import math
cnt=defaultdict(lambda:1)
n=int(input())
prime_number='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'
prime=list(map(int,prime_number.split()))
num=math.factorial(n)
for i in range(n):
    if i>=len(prime):
        break
    while num%prime[i]==0:
            num//=prime[i]
            cnt[prime[i]]+=1
ans=1
for i in cnt.values():
    ans*=i
print(ans%(10**9+7))

Solution (Python):

import math
from collections import Counter

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

def prime_factorize(n):
    c = Counter()
    for i in range(2, int(math.sqrt(n))+2):
      while n % i == 0:
        c[i] += 1
        n //= i
    
    if n > 1:
      c[n] += 1
    return c

counters = []
for n in range(1, N+1):
  counters.append(Counter(prime_factorize(n)))

cnt = Counter()
for c in counters:
  for (key, val) in c.items():
    cnt[key] += val
  
ans = 1

for (key, value) in cnt.items():
  ans *= value + 1

print(ans % mod)

Solution (Python):
N = int(input())
count = [1]*(N+1)
ans = 1
mod = 10**9+7

for i in range(2,N+1):
    wari = i
    for w in range(2,i+1):
        while wari % w == 0:
            count[w] += 1
            wari /= w

for i in range(N+1):
    ans *= count[i]

print(ans % mod)

Solution (Python):
import math

N = int(input())
num_fac = [0 for _ in range(N + 1)]
MOD = 10 ** 9 + 7

if N == 1:
	print(1)
else:
	for i in range(2, N + 1):
		for j in range(2, math.floor(math.sqrt(i)) + 1):
			while i % j == 0:
				i //= j
				num_fac[j] += 1
			if i == 1:
				break
		if i != 1:
			num_fac[i] += 1
	ans = 1		
			
	for i in range(len(num_fac)):
		if num_fac[i] != 0:
			ans *= ((num_fac[i] + 1) % MOD)
			ans %= MOD
	
	print(ans)

Solution (Python):
import math

def primeCheck(n):
    if n == 2:
        return n
    else:
        mx = math.ceil(n ** 0.5)
        for i in range(2, mx + 1):
            if n % i == 0:
                return -1
                break
            elif i == mx:
                return n

n = int(input())

fct = []

for i in range(2, n + 1):
    if primeCheck(i) == -1:
        continue
    else:
        mu = 0
        for j in range(1, 20):
            if n >= i ** j:
                mu += n // (i ** j)
            else:
                fct.append(mu)
                break

ans = 1
for k in range(len(fct)):
    ans *= fct[k] + 1

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

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



def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

def main():
    N = int(input())
    c = Counter()

    for i in range(1, N + 1):
        for j in prime_factors(i):
            c[j] += 1

    ans = 1
    for k in c.keys():
        ans *= (c[k] + 1)

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

    

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
from collections import Counter
INF = float("inf")

MOD = 1000000007  


def factorial(n):
    
    prime_count = Counter()

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

    return prime_count


def solve(N: int):

    primes = Counter()
    for i in range(1, N+1):
        primes += factorial(i)

    tot = 1
    for key in primes:
        tot *= primes[key]+1
        tot %= MOD

    print(tot)
    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):
from collections import defaultdict as dd
def factorization(n):
    """
    引数の値を素因数分解したリストを返す

    Parameters
    ----------
    n : int
        素因数分解したい自然数

    Returns
    -------
    retlist : list
        2以上の整数n => [[素因数, 指数], ...]の2次元リスト
    """
    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

n=int(input())
mod=10**9+7
ans=1
d=dd(int)
for i in range(2,n+1):
    a=factorization(i)
    for j in range(len(a)):
        d[a[j][0]]+=a[j][1]

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

Solution (Python):
from collections import defaultdict


def primes(n):
    if n == 1:
        return None

    while n % 2 == 0:
        ps[2] += 1
        n //= 2

    i = 3
    while i <= int(n ** .5) + 1:
        while n % i == 0:
            ps[i] += 1
            n //= i
        i += 2

    if n != 1:
        ps[n] += 1
    return None


N = int(input())
ps = defaultdict(int)

for n in range(1, N + 1):
    primes(n)

ans = 1
MOD = 10 ** 9 + 7
for key in ps:
    ans *= (ps[key] + 1) % MOD
    ans %= MOD

print(ans)

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

Solution (Python):
import math
import collections

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

def prime_factorize(n: int) -> list:
    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

fac = prime_factorize(math.factorial(n))
c = collections.Counter(fac)

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

print(ans)

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

L = [0] * (N)

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

for i in range(1,N + 1):
  P = prime_factorize(i)
  for j in range(len(P)):
    p = int(P[j])
    L[p - 1] += 1
    
total = 1
    
for i in L:
  if i != 0:
    total *= (i + 1)
    
div = 10 ** 9 + 7
  
print(total % div)

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

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 math
n = math.factorial(int(input()))
fac = prime_factorize(n)
ans = 1
mod = 7 + 10 ** 9
from collections import Counter
c = Counter(fac)
for i in c.values():
    ans *= (i + 1)
    ans %= mod
print(ans)

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

def 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

from collections import defaultdict as dd

d = dd(int)

for i in range(1, N+1):
    a = factorize(i)
    for j in a:
        d[j] += 1

ans = 1
for k, v in d.items():
    ans = ans * (v+1) % 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


MOD = 10**9+7
d = {}
ans = 1
n = int(input())
for i in range(2, n+1):
    x = factorization(i)
    for j in x:
        if j[0] in d:
            d[j[0]] += j[1]
        else:
            d[j[0]] = j[1]
for i in d.values():
    ans *= (i+1)
    ans %= MOD
print(ans)

Solution (Python):
import math
import collections
import functools


def solve():
    N = int(input())
    P = 10**9+7

    if N == 1:
        return 1

    fn = math.factorial(N)

    divisors = prime_factorize(fn)

    c = collections.Counter(divisors)

    ans = functools.reduce(lambda x, y: x * y, map(lambda x: x + 1, c.values()))

    return ans % P


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


if __name__ == '__main__':
    res = solve()
    print(res)

Solution (Python):
from math import factorial
from collections import Counter
MOD = 10 ** 9 + 7

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

n = int(input())
nn = factorial(n)
nnn = Counter(prime_decomposition(nn))

ans = 1
for i in nnn.values():
    ans *= i + 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())

prime_dict = dict()
for i in range(1, N+1):
    primes = factorization(i)
    for j in range(len(primes)):
        if primes[j][0] in prime_dict:
            prime_dict[primes[j][0]] += primes[j][1]
        else:
            prime_dict[primes[j][0]] = primes[j][1]
            
ans = 1
for k, v in prime_dict.items():
    if k != 1:
        ans *= v+1

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

Solution (Python):
import sys
input = sys.stdin.readline
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
from collections import Counter
n=int(input())
p=Counter()
for i in range(1,n+1):
    p.update(Counter(prime_factorize(i)))

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

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

from collections import Counter

MOD = 10**9+7

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

prime_fac = []
for i in range(1, N+1):
    prime_fac.extend(prime_factorize(i))

c = Counter(prime_fac)

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

Solution (Python):
from collections import defaultdict
 
N = int(input())
MOD = 10**9+7
mp = defaultdict(int)
for i in range(2, N+1) :
  x = i
  for j in range(2, x+1): 
    while x%j == 0:
      x /= j
      mp[j] += 1
      
ans = 1
for v in mp.values():
  ans = (ans * (v+1)) % MOD
print(ans)

Solution (Python):

def prime_factorization(N):
    tmp = N
    ans = []
    for i in range(2, int(N ** 0.5) + 1):
        count = 0
        while tmp % i == 0:
            tmp //= i
            count += 1
        if count != 0:
            ans.append([i, count])
    if tmp != 1:
        ans.append([tmp, 1])
    if ans == []:
        ans.append([N, 1])
    return ans


mod = 10 ** 9 + 7
N = int(input())
prime_list = [0] * N
if N == 1:
    print(1)
    exit()

for i in range(1, N+1):
    tmp_list = prime_factorization(i)
    
    for k in range(len(tmp_list)):
        prime_list[tmp_list[k][0]-1] += tmp_list[k][1]

ans = 1
for i in range(1, N):
    ans *= prime_list[i] + 1
    ans %= mod

print(ans)

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

n = int(input())

ans = 0
nums = [0]*(n+1)

for i in range(1,n+1):  
  v = i
  j = 2
  while v > 0 and i>=j:    
    if v%j==0:
      nums[j] += 1
      v = v//j      
    else:
      j+=1

ans = 1      
for i in range(n+1):
  if nums[i] > 0:
    ans *= (1+nums[i])
  ans %= MOD

print(ans)

Solution (Python):
p = []
for i in range(2, 1000):
  pix = 0
  for j in range(len(p)):
    if i % p[j] == 0:
      pix = 1
  if pix == 0:
    p.append(i)

mod = int(1e+9 + 7)
N = int(input())
D = {i: 0 for i in p}
for i in range(1, N + 1):
  if i in p:
    D[i] += 1
  else:
    for j in p:
      z = 0
      while i % j == 0:
        i //= j
        z += 1
      D[j] += z
prod = 1
for i in D:
  prod *= D[i] + 1
  prod %= mod
print(prod)

Solution (Python):
import math
n=int(input())
prime=[]


def expFactor(n, p): 
    x = p 
    exponent = 0
    while n // x > 0: 
      
        exponent += n // x 
        x *= p 
    return exponent 

ans=1

if(n>=2):
    prime.append(2)
for i in range(3,n+1):
    countt=0
    for j in range (1,int(math.sqrt(i))+1):
        if(i%j==0):
            countt+=1
    if(countt==1):
        prime.append(i)

for i in prime:
    ans*=(expFactor(n,i)+1)
print(ans%(1000000007))

Solution (Python):
def prmry_num_li(mx_int = 10**5):
    li = [True for i in range(mx_int+1)]
    li[0] = False
    li[1] = False

    for i in range(2,int(mx_int**0.5)+1):
        if (li[i]):
            j = 2
            while (i*j <= mx_int):
                li[i*j] = False
                j+= 1
    lis = []
    for i in range(len(li)):
        if li[i]:
            lis.append(i)

    return lis


n = int(input())
li = prmry_num_li(n)
cnt = [0 for _ in range(len(li))]

for i in range(1,n+1):
    num = i
    plc = 0
    while(num!=1):
        if num%li[plc]==0:
            num/=li[plc]
            cnt[plc] += 1
        else:
            plc+=1

mod = 10**9+7
ans = 1 
for j in range(len(cnt)):
    ans = (ans*(cnt[j]+1))%mod

print(ans%mod)

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

def primer(x):
    res = []
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

res_all = []
for i in range(N+1):
    res_all.extend(primer(i))
from collections import Counter
D = Counter(res_all)
ans = 1
for value in D.values():
    ans *= value+1
    ans %= 10**9+7
print(ans)

Solution (Python):


import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
    """ 素因数分解 """
    from math import sqrt
    from collections import Counter

    d = Counter()
    
    for i in range(2, int(sqrt(num))+1):
        
        while num % i == 0:
            num //= i
            d[i] += 1
        
        if num == 1:
            break
    
    if num != 1:
        d[num] += 1
    return d

N = INT()


C = Counter()
for a in range(2, N+1):
    C.update(factorize(a))


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

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)
        answer%=MOD
    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 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):
def f(x):
  out=[]
  for j in range(2, int(x**(1/2))+1, 1):
    while x%j==0:
      out.append(j)
      x//=j
      if x==1:
        break
  if x!=1:
    out.append(x)
  return out

N=int(input())
mod=10**9+7
nums=[1]*(N+1)
for i in range(2, N+1):
  a=f(i)
  for j in a:
    nums[j]+=1
    
for i in range(3, N+1):
  nums[i]=(nums[i-1]*nums[i])%mod
  
print(nums[-1])

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

def main():
    N = int(input())
    l = [0 for _ in range(N)]
    is_prime = [True for _ in range(N+1)]
    is_prime[0],is_prime[1] = False,False
    INF = 10**9+7
    
    for i in range(N+1):
        if is_prime[i]:
            for j in range(2*i,N+1,i):
                is_prime[j] = False

    fa = [0 for _ in range(N+1)]                
    for x in range(1,N+1):
        for i in range(1,x+1):
            if (is_prime[i] and x%i == 0):
                while x%i == 0:
                    fa[i] += 1
                    x //= i
 
    ans = 1
    for i in range(N+1):
        ans *= fa[i]+1
        ans %= INF
        
    print(ans)
    
if __name__ == "__main__":
    main()

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

def main():
    N = int(input())
    l = [0 for _ in range(N)]
    is_prime = [True for _ in range(N+1)]
    is_prime[0],is_prime[1] = False,False
    INF = 10**9+7
    
    for i in range(N+1):
        if is_prime[i]:
            for j in range(2*i,N+1,i):
                is_prime[j] = False

    fa = [0 for _ in range(N+1)]                
    for x in range(1,N+1):
        for i in range(1,x+1):
            if (is_prime[i] and x%i == 0):
                while x%i == 0:
                    fa[i] += 1
                    x //= i
 
    ans = 1
    for i in range(N+1):
        ans *= fa[i]+1
        ans %= INF
        
    print(ans)
    
if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
F = {}
for n in range(2,N+1):
    _n = n
    f = 2
    while f*f<=_n:
        if n%f==0 and f not in F: F[f] = 0
        while n%f==0:
            n//=f
            F[f]+=1
        f+=1
    if n>1:
        if n not in F: F[n] = 0
        F[n] += 1

ans = 1
mod = 10**9+7
for _, k in F.items():
    ans = ans*(k+1)%mod
print(ans)

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

if N == 1 or N == 2:
    print(N)
    exit()


candidate = [0] * 1001

candidate[2] = 1
candidate[3] = 1
for i in range(4,N + 1):
    tmp = i
    for j in range(2, int(i ** (1/2)) + 1):
        while tmp % j == 0:
            candidate[j] += 1
            tmp = tmp // j
    candidate[tmp] += 1

ans = 1
for i in range(2,len(candidate)):
    if candidate[i] != 0:
       ans = ans * (candidate[i] + 1) % 1000000007
print(ans)

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

if N == 1 or N == 2:
    print(N)
    exit()


candidate = [0] * 1001

candidate[2] = 1
candidate[3] = 1
for i in range(4,N + 1):
    tmp = i
    for j in range(2, int(i ** (1/2)) + 1):
        if tmp % j == 0:
            while tmp % j == 0:
                candidate[j] += 1
                tmp = tmp // j
    candidate[tmp] += 1

ans = 1
for i in range(2,len(candidate)):
    if candidate[i] != 0:
       ans = ans * (candidate[i] + 1) % 1000000007
print(ans)

Solution (Python):
from collections import defaultdict


def trial_division(n):
    '''
    素因数分解する
    '''
    factor = []
    for num in range(2, int(n**0.5)+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor or n != 1:
        factor.append(n)
    return factor


N = int(input())
divisor_dict = defaultdict(int)
for i in range(2, N+1):
    divisors = trial_division(i)
    for d in divisors:
        divisor_dict[d] += 1
ans = 1
for v in divisor_dict.values():
    ans = (ans * (v+1)) % (1e9 + 7)
print(int(ans))

Solution (Python):
"""
ある整数 x が、素因数分解によって x = p^n × q^m × ... (p, q, ...は素数) と表せる時、
x の約数の個数は(n + 1) × (m + 1) × ... となります。
"""

"""nを素因数分解"""
"""2以上の整数n => return [[素因数, 指数], ...]の2次元リスト"""
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
  
from collections import defaultdict
N = int(input())
MOD = 10**9+7
primes = defaultdict(int)

for i in range(2, N+1):
  for k, v in factorization(i):
    primes[k] += v

ans = 1  
for k, v in primes.items():
  ans = ans * (v+1)%MOD
print(ans)

Solution (Python):
from collections import defaultdict

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

for i in range(2, N+1) :
  x = i
  for j in range(2, x+1): 
    while x%j == 0:
      x /= j
      mp[j] += 1
      
ans = 1
for v in mp.values():
  ans = ((ans%MOD) * (v+1)%MOD) % 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
MOD=10**9+7
N=int(input())

S=dict(zip(list(range(1,1001)),[0]*1000))
for n in range(1,N+1):
    D=prime_factorize(n)
    for d in D:
        S[d]+=1

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

Solution (Python):
import math
n=int(input())
m=math.factorial(n)
arr=[1]*1000
for i in range(2,1001):
  while m%i==0:
    m//=i
    arr[i]+=1
ans=1
for i in arr:
  ans*=i
print(ans%(10**9+7))

Solution (Python):

import math
import collections

MODBY = 7 + 10**9

N = int(input()) 

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

pf_dict = dict()

for i in range(2,N+1):
    c = collections.Counter(prime_factorize(i))
    for j in c.items():
        if j[0] not in pf_dict:
            pf_dict[j[0]] = j[1]
        else:
            pf_dict[j[0]] += j[1]

ans = 1
for i in  pf_dict.values():
    ans = ans*(i+1)
    
print(ans%MODBY)

Solution (Python):
n = int(input())
prime_dic = {}

def prime_factorization(n):
    count = 0
    while n % 2 == 0:
        count += 1
        n = n / 2
    
    if 2 in prime_dic.keys():
        prime_dic[2] += count
    else:
        two = {2:count}
        prime_dic.update(two)

    f = 3
    count = 0
    while f*f <= n:
        if n % f == 0:
            
            if f in prime_dic.keys():
                prime_dic[f] += 1
            else:
                new = {f:1}
                prime_dic.update(new)
            n = n / f
        else:
            f += 2
    if n != 1:
        if n in prime_dic.keys():
            prime_dic[n] += 1
        else:
            new = {n:1}
            prime_dic.update(new)
    return 

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

ans = 1
for key, val in prime_dic.items():
    ans = ans * (val+1) % (10**9 +7)

print(ans)

Solution (Python):




primes = []
numbers = [False for _ in range(10 ** 3 + 1)]

for i in range(2, 10 ** 3 + 1):
    if numbers[i] == False:
        primes.append(i)
        for j in range(i, 10 ** 3 + 1, i):
            numbers[j] = True

n = int(input())
ans = 1
MOD = 10 ** 9 + 7
d = {}

for i in range(2, n + 1):
    tmp = i
    for p in primes:
        while tmp % p == 0 and tmp != 0:
            d[p] = 1 if p not in d else d[p] + 1
            tmp //= p

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

print(ans)

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


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

from collections import defaultdict
dic = defaultdict(int)
for i in range(n+1):
    for k in prime_decomposition(i):
        dic[k] += 1

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

print(ans)