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:
#!/usr/bin/env python3
import sys
import math
MOD = 1000000007  # type: int
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))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from collections import defaultdict


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

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - Factors of Factorial

import collections

N = int(input())

# n以下の全ての素数のセットを返す関数
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

# nを素因数分解して素因数の全リストを返す関数
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    # print(prime_factor)
    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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC052 C - Factors of Factorial
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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  # 1は素数の0乗の積とみなす(n==1のときのため)
        while i**2 <= n:
            while n % i == 0:
                table[i] += 1
                n //= i
            i += 1
        if n > 1:
            table[n] = 1  # nが素数のとき
        return table

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

print(c_factors_of_factorial())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
# from sympy import sieve
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)
    

# primeNum = [i for i in sieve.primerange(1,1000)]
# print(primeNum)
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    MOD = 10**9 + 7
    ans = 1
    primes = sorted(Eratosthenes(N))
    for p in primes:
        cur = 0
        k = 1
        while p**k <= N:
            cur += N//(p**k)
            k += 1
        ans = ans * (cur+1) % MOD
    print(ans%MOD)

def Eratosthenes(x: int) -> set:
    """x以下の素数のsetを返す"""
    import math
    sup = int(x)
    primes = {i for i in range(2,sup+1)}
    for i in range(2,int(math.sqrt(sup+1))+1):
        if i in primes:
            mul = 2
            while i*mul <= sup:
                primes.discard(i*mul)
                mul += 1
    return primes

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
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
fact = Counter()
for i in range(1,N+1):
    fact += Counter(prime_factorize(i))
ans = 1
for j in fact.values():
    ans = ans * (j+1)
print(ans%mod)

Submission status: Accepted

Solution code:
def isp(n):
  for i in range(2, int(n**(1/2))+1):
    if n % i == 0:
      return False
  return True    

N = int(input())
prime = []
ans = 1
mod = 10 ** 9 + 7

for i in range(2, N+1):
  if isp(i):
    prime.append(i)
A = [1] * len(prime)

for i in range(2, N+1):
  n = i
  for j in range(len(prime)):
    p = prime[j]
    while n % p == 0:
      n = n//p
      A[j] += 1
for a in A:
  ans = ans * a % mod
#print(A)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
m=10**9+7
p=[]
for k in range(2,n+1):
  f=1
  for i in p:
    if k%i==0:
      f=0
      break
  if f==1:
    p+=[k]
l=[1]*len(p)
for i in range(len(p)):
  d=p[i]
  x=n//d
  while x>0:
    l[i]+=x
    x//=d
a=1
for i in l:
  a*=i
  a%=m
print(a)

Submission status: Accepted

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

INF = 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 = Counter({})
for i in range(1, N+1):
  c += Counter(prime_factorize(i))

ans = 1
for i in c.values():
  ans = (ans * (i + 1)) % INF
print(ans)

Submission status: Accepted

Solution code:
from math import factorial as fact
ans = 1
n = int(input())
m = fact(n)
for i in range(2, n+1):
    tmp = 1
    while m%i==0:
        m //= i
        tmp += 1
    ans *= tmp
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
import math

N = int(input())

MOD = 10 ** 9 + 7

# エラトステネスの篩(ふるい)
# 計算量はnloglogn(?)
# かなり早い
# n以下の自然数の内、素数であるものをリストに入れて返す関数
def eratosthenes(n):
    # 1からnのところにTrueを格納
    # is_primeがTrueは素数を表す
    is_prime = [True] * (n + 1)

    # 1,2は素数
    is_prime[0] = False
    is_prime[1] = False

    # iは着目する数
    # 高速化1
    # ・nまでの自然数のうち、約数の候補としてはrootnまでしかない
    for i in range(2, int(math.sqrt(n))+1):
        # 高速化2
        # ・iが既にFalseだったら(not False = True)それは回さなくて良い
        if not is_prime[i]:
            continue
        # j=2i,3i,4i,...と続く
        # j番目は素数でない
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False

    # is_primeがTrueとなっている所のみ数を入れる
    return [i for i in range(n + 1) if is_prime[i]]

prime = eratosthenes(N)

M = len(prime)
cnt = [0]*M
for i in range(M):
    p = prime[i]
    while p <= N:
        cnt[i] += N // p
        p *= prime[i]

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

Submission status: Accepted

Solution code:
# こちらの方がやや高速
import math

N = int(input())

MOD = 10 ** 9 + 7

# 試し割り法(2以外の偶数は捨てる方法を追加)
def check_prime(n):
    flag = True

    # n:evenかつ2でないならば素数でない
    # n=1は素数でない,n=0も実装しやすいように入れておく
    if (n % 2 == 0 and n != 2) or n == 0 or n == 1:
        flag = False
        return(flag)

    # n:oddまたは2のときは考える
    else:
        # 2からrootnまでに約数は存在しうる
        for i in range(2, math.floor(math.sqrt(n))+1):
            if n % i == 0:
                flag = False
                break
        return(flag)

# N以下の素数を格納
prime = []
for i in range(N+1):
    if check_prime(i):
        prime.append(i)

M = len(prime)
cnt = [0]*M
for i in range(M):
    p = prime[i]
    while p <= N:
        cnt[i] += N // p
        p *= prime[i]

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

Submission status: Accepted

Solution code:
import math

N = int(input())

MOD = 10 ** 9 + 7

# 試し割り法(2以外の偶数は捨てる方法を追加)
def check_prime(n):
    flag = True

    # n:evenかつ2でないならば素数でない
    # n=1は素数でない,n=0も実装しやすいように入れておく
    if (n % 2 == 0 and n != 2) or n == 0 or n == 1:
        flag = False
        return(flag)

    # n:oddまたは2のときは考える
    else:
        # 2からrootnまでに約数は存在しうる
        for i in range(2, math.floor(math.sqrt(n))+1):
            if n % i == 0:
                flag = False
                break
        return(flag)

# N以下の素数を格納
prime = []
for i in range(N+1):
    if check_prime(i):
        prime.append(i)

M = len(prime)
cnt = [0]*M # primeで割れる個数を格納
for i in range(1, N+1):
    for j in range(M):
        p = prime[j]
        if p > i:
            break
        else:
            while i % p == 0:
                i //= p
                cnt[j] += 1

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

Submission status: Accepted

Solution code:
import math


def __sieve(num):
    sieved_set = set()
    for i in range(2, num + 1):
        sieved_set.add(i)

    # エラトステネスの篩法で素数を計算する
    for i in range(2, int(math.sqrt(num)) + 1):
        for j in range(2, num + 1):
            if (j % i == 0) and (j != i) and (j in sieved_set):
                sieved_set.remove(j)

    return sieved_set


def __calc_divisor(num, prime_count_array):
    for prime in prime_count_array:
        count = 0
        temp_divided = num
        while temp_divided % prime == 0:
            count += 1
            temp_divided /= prime
        prime_count_array[prime] += count


n = int(input())

# 素数を計算
primes = __sieve(n)

# N! の各項について、素因数分解する
prime_count_array = {}
for i in primes:
    prime_count_array[i] = 0
for i in range(2, n + 1):
    __calc_divisor(i, prime_count_array)

# 素因数分解結果から約数の個数を計算
divisor_count = 1
for divisor_count_of_prime in prime_count_array.values():
    divisor_count *= (divisor_count_of_prime + 1)

# 出力用に余りを算出
print(divisor_count % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
import math
num=int(input())
n=math.factorial(num)
prime="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"
primes=prime.split()
dictionary={}

order=0
k=0
for som in primes:
    some=int(som)
    while n%some**k==0:
            k+=1 
    dictionary[som]=k-1
    k=0
ans=1
for i, v in dictionary.items():
    ans*=(v+1)
    ans=ans%(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import math
import collections
import sys
sys.setrecursionlimit(500000)

def f(n,i):
    while i * i <= n:
        if n % i == 0:
            a.append(i)
            n //= i
        else:i += 1
    if n != 1:
        a.append(n)
    return a

a = []
n = math.factorial(int(input()))
c = collections.Counter(f(n,2))
d = [i[1]+1 for i in c.items()]
ans = 1
for i in range(len(d)):
    ans = (ans * d[i]) % 1000000007
print(ans)

Submission status: Accepted

Solution code:
import math
import collections
def f(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(f(math.factorial((int(input())))))
d = [i[1]+1 for i in c.items()]
ans = 1
for i in range(len(d)):
    ans = (ans * d[i]) % 1000000007
print(ans)

Submission status: Accepted

Solution code:
import collections

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

N = int(input())
ans, temp = 1, [0] * (N+1)
for i in range(2, N+1):
    c = prime_factorize(i)
    divs, exps = list(c.keys()), list(c.values())
    for j in range(len(divs)):
        temp[divs[j]] += exps[j]

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

Submission status: Accepted

Solution code:
import math
import collections

N = int(input())
n = math.factorial(N)
a = []
ans = 1
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)
a = collections.Counter(a)
for i in a.values():
    ans *= (i + 1)
print(ans % 1000000007)

Submission status: Accepted

Solution code:
n=int(input());a=1;r=range
for x in[i for i in r(2,n+1)if all(i%j for j in r(2,i))]:a*=sum(n//x**i for i in r(1,11))+1
print(a%(10**9+7))

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



def sieve(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


n = I()
primes = sieve(n)
prime_num = len(primes)
L = prime_num * [0]
for i in range(prime_num):
    ret = primes[i]
    while ret <= n:
        L[i] += n // ret
        ret *= primes[i]


ans = 1
for j in range(prime_num):
    ans = ans * (L[j] + 1) % mod



print(ans)