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



Sample input:
3


Sample output:
4

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

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

dic = defaultdict(int)
for i in range(2, N+1):
	fact = factorization(i)
	for n, power in fact:
		dic[n] += power

ans = 1
for n in dic.values():
	ans = (ans*(n+1))%mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
primenumber = []
if n == 1 :
    primenumber = []
else :
    for i in range(2, n + 1) :
        for j in range(2, i + 1) :
            if i == j :
                pass
            elif i % j == 0 :
                break
        else :
            primenumber += [j]
powers = [0] * len(primenumber)
for i in range(len(primenumber)) :
    prime = primenumber[i]
    power = 0
    k = 1
    while n // (prime ** k) > 0 :
        power += n // (prime ** k)
        k += 1
    powers[i] = power + 1
ans = 1
for power in powers :
    ans *= power
print(ans % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
N=int(input())
check=[0]*(N+1)

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

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

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

    return arr

for i in range(2,N+1):
  facts=factorization(i)
  for fact in facts:
    check[fact[0]]+=fact[1]
    
ans=1
for c in check:
  if c==0:
    continue
  ans=((ans%DIV)*((c+1)%DIV))%DIV

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import math
from itertools import groupby

n = int(stdin.readline().rstrip())
total = math.factorial(n)

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

li = prime_factorize(total)
lin = []
for key, value in groupby(li):
    lin.append(len(list(value)))

point = 1

for i in lin:
    point *= i+1
    point %= 10**9+7

print(point)

Submission status: Accepted

Solution code:
import collections
s = int(input())
a = []
def prime_factorize(n):
    global 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)

for i in range(2,s+1):
    prime_factorize(i)

c = collections.Counter(a)
ans = 1
for i in c.values():
    ans *= (i+1)
    ans %= 1000000007

print(ans)

Submission status: Accepted

Solution code:
def prime_factor(n):
    ret = {}
    p = 2

    while p*p <= n:
        while n % p == 0:
            ret[p] = ret.get(p, 0) + 1
            n //= p
        p += 1

    if n != 1: ret[n] = 1

    return ret

n = int(input())
d = {}

for i in range(2, n+1):
    t = prime_factor(i)
    for k, v in t.items():
        d[k] = d.get(k, 0) + v

ans = 1
mod = int(1e9) + 7

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
n_prime = [[2,0]]
x = 1
ans = 1
for i in range(2,n+1):
  for j in range(x):
    while(i % n_prime[j][0] == 0):
      n_prime[j][1] += 1
      i /= n_prime[j][0]
  if i != 1:
    n_prime.append([i,1])
    x += 1
for k in range(x):
  ans = ans * (n_prime[k][1]+1) % mod
print(ans)

Submission status: Accepted

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

import math
s=math.factorial(n)
i=2
ans=1
cnt=0
while s!=1:
    if s%i==0:
        s//=i
        cnt+=1
    else:
        ans*=(cnt+1)
        cnt=0
        i+=1

print(ans*(cnt+1)%mod)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

def prime_factorization(n):
    assert(n>1)
    factor=[]
    sqrt=int(n**.5)
    for d in range(2,sqrt+1):
        while(n%d==0):
            n//=d
            factor.append(d)
    if n!=1: factor.append(n)
    return factor

from collections import defaultdict

def resolve():
    n=int(input())
    C=defaultdict(int)
    for x in range(2,n+1):
        for p in prime_factorization(x):
            C[p]+=1
    ans=1
    for v in C.values():
        ans*=v+1
        ans%=MOD
    print(ans)
resolve()

Submission status: Accepted

Solution code:
def prime_factorize(n):
    res = []
    p = 2
    while p*p <= n:
        if n % p != 0:
            p += 1
            continue
        num = 0
        while n % p == 0:
            num += 1
            n //= p
        res.append( [p, num] )
        p += 1

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

    return res


# n! の約数の数を mod で割った余りを返す
def mod_div_fact(n, mod):
    d = {}
    for i in range(2, n+1):
        L = prime_factorize(i)
        for (p, e) in L:
            d[p] = d.get(p, 0) + e
    res = 1
    for v in d.values():
        res *= (v+1)
        res %= mod
    return res;

n = int(input())
mod = int(1e9)+7

print(mod_div_fact(n, mod))

Submission status: Accepted

Solution code:
n=int(input())
yaku=set()
mod=7+10**9

#まず2~1000までの素数のリスト作る
primes=[]
for i in range(2,1001):
  flag=0
  for j in range(2,i):
    if j!=i and i%j==0:
      flag=1
      break 
  if flag==0:
    primes.append(i)

#1000!に、それぞれの因数が何個あるか記録するリスト
insu=[0]*len(primes)

#1~1000まで素因数分解して、それぞれの因数の個数分記録する処理
for i in range(2,n+1):
  n=0
  while i!=1:
    if i%primes[n]==0:
      insu[n]+=1
      i=i//primes[n]
    else:
      n+=1
#print(insu)
ans=1
for i in insu:
  ans*=(i+1)
  ans%=mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
exps = [0] * 1003

for i in range(2, n+1):
    t = i
    div = 2
    while div*div <= i:
        if t % div == 0:
            exps[div] += 1
            t //= div
        else:
            div += 1
    if t != 1:
        exps[t] += 1

ans = 1
mod = int(1e9) + 7

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
exps = [0] * 1003

for i in range(2, n+1):
    t = i
    div = 2
    while div*div <= n:
        if t % div == 0:
            exps[div] += 1
            t //= div
        else:
            div += 1
    if t != 1:
        exps[t] += 1

ans = 1
mod = int(1e9) + 7

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

print(ans)

Submission status: Accepted

Solution code:
# ABC052c
import sys
from math import factorial
from collections import Counter
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = 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


ans = 1
for i in Counter(prime_factorize(factorial(n))).values():
    ans = ans*(i+1) % MOD
print(ans)

Submission status: Accepted

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

# 素因数を求める
def prime_factorization(n):
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if i in prime:
                prime[i] += cnt
            else:
                prime[i] = cnt
    if tmp != 1:
        if tmp in prime:
            prime[tmp] += 1
        else:
            prime[tmp] = 1

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

res = 1
for v in prime.values():
    res *= v + 1
    res %= mod

print(res)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = int(inputs[0])
    SSSS = 1000000007
    count = collections.Counter()

    for i in range(1, N+1):
        target = i
        is_end = False
        while not is_end:
            is_end = True
            for j in range(2, int(math.sqrt(target)+1)):
                if target % j == 0:
                    count[j] += 1
                    target = target // j
                    is_end = False
                    break
            if is_end and target != 1:
                count[target] += 1
    c = 1
    for k, v in count.items():
        c *= (v + 1)
        c = c % SSSS
    return c


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
#C
import math
mod = 10**9+7
N = int(input())

prime = [2]
for i in range(N):
    I = i+1
    In = math.ceil(math.sqrt(I))
    flag = 0
    for j in range(In):
        J = j+1
        if I%J == 0 and J!=1:
            flag = 1
            break
    if flag == 0 and I!=1:
        prime.append(I)
#print(prime)

ans = 1
for p in prime:
    q = 0
    pp = p
    while pp <= N:
        q+=(N//pp)
        pp*=p
    ans*=(q+1)
    
print(ans%mod)

Submission status: Accepted

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

NNN = [i for i in range(1,N+1)]
numofprime=[]

for i in range(2,N+1):
    counti = 0
    for j in range(len(NNN)):
        while True:
            if NNN[j] %i !=0:
                break
            NNN[j] = NNN[j]/i
            counti += 1
    numofprime.append([i,counti])



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

#print(numofprime)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

def factors(p, n):
    ret = 0
    m = p
    while m <= n:
        ret += n // m
        m *= p        
    return ret

ans = 1
for i in range(1, n+1):
    if prime(i):
        ans = ans * (factors(i, n) + 1) % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def prime(n):
    ret = True
    for i in range(1, int(n**0.5) + 1):
        if i != 1 and n % i == 0:
            ret = False
            break
    return ret

def factors(p, n):
    a = p
    ret = 0
    while p <= n:
        ret += n // p
        p *= a
    return ret

ans = 1
for i in range(2, n+1):
    if prime(i):
        ans = ans * (factors(i, n) + 1) % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
X = [-1] * (N+1)
Y = [0] * 1000
L = [{} for _ in range(N+1)]
k = 2
while k <= N:
    X[k] = 1
    L[k][k] = 1
    for i in range(k*2, N+1, k):
        X[i] = 0
        L[i][k] = 1
    d = 2
    while k**d <= N:
        for i in range(k**d, N+1, k**d):
            L[i][k] += 1
        d += 1
    while k <= N and X[k] >= 0:
        k += 1

for l in L:
    for p in l:
        Y[p] += l[p]

ans = 1
for y in Y:
    ans *= y + 1
print(ans % (10**9+7))

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
divine = [1 for _ in range(N+1)]

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

for k in divine:
    ans *= k

print(ans%1000000007)

Submission status: Accepted

Solution code:
import math
N = int(input())
d = math.factorial(N)

k, ans = 1, 1
for i in range(2, N + 1):
    while d % i == 0:
        d //= i
        k += 1
    ans *= k
    k = 1
print(ans % (10**9 + 7))

Submission status: Accepted

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

N = int(input())
a = [0]*(N+1)
for i in range(2, N+1):
    prime_factorize(i)
ans = 1
for i in a:
    if i > 0:
        ans *= (i+1)
big = 10**9 + 7
print(ans % big)

Submission status: Accepted

Solution code:
N = int(input())
e = 10**9 + 7
P = []
for i in range(2,N+1):
    a = 1
    for p in P:
        if i % p == 0:
            a = 0
            break
    if a == 1:
        P.append(i)
d = {}
for p in P:
    d[p] = 1
for i in range(1,N+1):
    x = i
    for p in P:
        while x % p == 0:
            x = x//p
            d[p] += 1
ans = 1
for p in P:
    ans = (ans*d[p])%e
    
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
d=math.factorial(n)
k=1
ans=1
for i in range(2,n+1):
  while d%i==0:
    d//=i
    k+=1
  ans*=k
  k=1
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
n=int(input())
data=[0]*(n+1)
for i in range(2,n+1):
    while i%2==0:
        i//=2
        data[2]+=1
    j=3
    while i>1:
        if i%j==0:
            i//=j
            data[j]+=1
        else:
            j+=2
ans=1
mod=10**9+7
for i in range(n+1):
    if data[i]!=0:
        ans=ans*(data[i]+1)%mod
print(ans)

Submission status: Accepted

Solution code:
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
from collections import defaultdict
N = int(input())

Primes = []
is_prime = [True]*(N+1)
is_prime[0] = is_prime[1] = False

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

dic = defaultdict(int)

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

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

print(ans)

Submission status: Accepted

Solution code:
def pff(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf

def examC(mod):
    N = I()
    ans = int(1)
    d = defaultdict(int)
    for i in range(2,N+1):
        m = pff(i)
#        print(m)
        for v in m:
            d[v] += m[v]
#    print(d)
    for i in d:
        ans = (ans*(d[i]+1))%mod
    print(ans)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC(mod)

Submission status: Accepted

Solution code:
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())
Mod = 10 ** 9 + 7
if N == 1:
    print(1)
    exit()
d = defaultdict(int)
for i in range(2, N + 1):
    l = factorization(i)
    for j in range(len(l)):
        d[l[j][0]] += l[j][1]
# print(d, list(d.values()))
l = list(d.values())
ans = 1
for i in range(len(l)):
    ans = ans * (l[i] + 1) % Mod
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from functools import reduce

N = int(input())

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

def main():
    li = []
    for i in range(1, N + 1):
        li += pf(i)
    ans = 1
    for v in Counter(li).values():
        ans *= v + 1
    print(ans % 1000000007)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
Data = {}

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 addData(pflist):
    for p in pflist:
        if p in Data:
            Data[p]+=1
        else:
            Data[p]=1

MOD = 10**9+7
N = int(input())
for n in range(1,N+1):
    x = prime_factorize(n)
    addData(x)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INF = 1e9 +7

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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)

Submission status: Accepted

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

Submission status: Accepted

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


def primeNumber(n, pn):
    # Sieve of Eratosthenes
    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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

factorial_of_n = math.factorial(N)

def countOfPrimeFactors(n):
    # when n > factorial(196), system may overflows
    # if then, try to replace 'int(n**0.5)+1' by '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)

Submission status: Accepted

Solution code:
def primeFactorize(n):
    if n > 1:
        prime_factors = []
        while n % 2 == 0:
            n //= 2 
            # n is divisible by 2 so 'n //= 2' is equal to 
            # 'n /= 2'. but '//=' returns an integer, whereas 
            # '/=' returns a float.
            prime_factors.append(2)
        
        # n cannot be a even number at this point. 
        # so range is from 3 to int(n**0.5), but step is 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: # otherwise, n > i.
                return prime_factors
        # if n != 1, n > i(int(n**0.5) or int(n**0.5)-1).
        # (i == int(n**0.5) if int(n**0.5) is an odd number.)
        # (i == int(n**0.5)-1 if int(n**0.5) is an even number.)
        prime_factors.append(n)
        return prime_factors
    else:
        return []


def findPrimeNumbers(n):
    # return a list of prime numbers less than or equal to 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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
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)
    #print(divisors)
    
    ans = 1
    for i in divisors:
        #print(ans)
        a,b = i
        ans = ans * (b+1)
        ans = ans % 1000000007
        
    print(ans)
    
    
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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