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:
#エラトネスの篩
def Eratosthene(n):
    prime = [1]*(n+1)
    prime[0] = 0
    prime[1] = 0

    for i in range(2, int(n**0.5)+1, 1):
        if prime[i]==0:
            continue
        for j in range(i+1, n+1, 1):
            if prime[j]==0:
                continue
            if j%i==0:
                prime[j] = 0
    return prime

prime = Eratosthene(10**3)
P = []
for i in range(10**3+1):
    if prime[i]==1:
        P.append(i)

N = int(input())

ANS = 1
for p in P:
    a = p
    ans = 0
    while 1:
        if N/p>0:
            ans = ans + int(N/p)
        else:
            break
        p = p*a
    ANS = ANS * (ans+1)
print(ANS%(10**9+7))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


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 not arr:
        arr.append([n, 1])
    
    return arr


def solve():
    N = int(rl())
    MOD = 10 ** 9 + 7
    
    counter = defaultdict(int)
    for i in range(2, N + 1):
        facts = factorization(i)
        for j, cnt in facts:
            counter[j] += cnt
    
    ans = 1
    for val in counter.values():
        ans = ans * (val + 1) % MOD
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import math

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

def eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

if n==1:
    print(1)
    exit()

era = eratosthenes(n)

dict = {}
for i in range(n):
    num = i+1
    while num!=1:
        for j in era:
            while num%j==0:
                num/=j
                if j in dict:
                    dict[j]+=1
                else:
                    dict[j]=1

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

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
N = int(input())

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
res = 1
MOD = 10**9+7
dic = dd(int)
for i in range(1,N+1):
    f = factorize(i)
    for val in f:
        dic[val] += 1
for val in dic.values():
    res = res*(val+1)%MOD
print(res)

Submission status: Accepted

Solution code:
from math import factorial
from collections import defaultdict

n = int(input())
cnt = defaultdict(int)
n = factorial(n)
i = 2
while n >= i:
    if n % i == 0:
        n //= i
        cnt[i] += 1
    else:
        i += 1    
ans = 1
#print(cnt)
for k, v in cnt.items():
    ans *= v + 1

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def prime_factorize(n, ex_table):
    for i in range(2, int(n**0.5)+1):
        if n % i != 0:continue
        while n % i == 0:
            ex_table[i] += 1
            n = n//i
    if n != 1:ex_table[n] += 1
def main():
    N = int(input())
    ex_table = {i:0 for i in range(2, N+1)}
    for i in range(1, N+1):
        prime_factorize(i, ex_table)
    ans = 1
    MOD = 10 ** 9 + 7
    for k in ex_table:
        ans *= (ex_table[k] + 1)
        ans %= MOD
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    l=[0]*(N+1)
    for i in range(1,N+1):
        a=2
        while i>1:
            if i%a==0:
                l[a]+=1
                i//=a
            else:
                a+=1
    
    ans=1
    for x in l:
        ans*=x+1
        ans%=MOD
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def prime_factorize(n):
  # nの素因数分解
  a = []
  while n % 2 == 0:
    a.append(2)
    n = n // 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n = n // f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

def abc052_c():
  n = int(input())
  if n == 1:
    print(1)
    return

  # 2...nを素因数分解してすべて集める
  primes = []
  for i in range(2, n+1):
    primes += prime_factorize(i)

  # N!の約数を生成する組合せ数
  # 各素因数の出現回数+1(何も使わないも含めて)を掛け合わせる
  div = 10**9 + 7
  ans = 1
  from collections import Counter
  for kv in Counter(primes).items():
    ans = ans * (kv[1] + 1) % div
  print(ans)

abc052_c()

Submission status: Accepted

Solution code:
n = int(input())
dp = list(0 for _ in range(n+1))

for i in range(2,n+1):
  #素因数分解の試し割り法
  while i%2==0:
    dp[2] += 1
    i //= 2
  f = 3
  while f*f<=i:
    if i%f==0:
      dp[f] +=1
      i //= f
    else:
      f += 2
  if i!=1:
    dp[i] += 1
#指数を数えていく
s = 1
for i in dp:
  if i!=0:
    s *= i+1
print(s%(10**9+7))

Submission status: Accepted

Solution code:
def is_prime(q):
    if q < 2 or q&1 == 0: return False
    return pow(5, q-1, q)*pow(7, q-1, q) == 1
  
def main():
  mod = 10**9+7
  n = int(input())
  ans = 1
  if n == 1:
    print(1)
    exit()
  
  b = [2]
  for i in range(2,min(n+1,998)):
    if i == 5 or i == 7:
      b.append(i)
    if i == 561:
      continue
    if is_prime(i):
      b.append(i)
      
  for i in b:
    p = i
    cnt = 1
    chk = 1
    for j in range(10):
      chk += n//p
      if p > n:
        ans *= chk
        ans %= mod
        chk = 1
        break
      p *= i
      
  print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def divisor(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    maxitr = intSqrt(n)
    i = 1
    while True:
        i += 4
        if i > maxitr:
            return n
        elif n % i == 0:
            return i
        i += 2
        if i > maxitr:
            return n
        elif n % i == 0:
            return i


def factorization(n, simple=True):
    result = []
    while n > 1:
        div = divisor(n)
        result.append(div)
        n //= div
    return result


def intSqrt(n):
    x = 1
    while True:
        x2 = (x + n // x) // 2
        if abs(x - x2) <= 1:
            break
        x = x2
    return x2


def ABC052C(n):
    factor = []
    for i in range(2, n+1):
        factor.extend(factorization(i))
    # index, counts = sp.unique(factor, return_counts=True)
    d = {}
    for c in factor:
        if c in d.keys():
            d[c] += 1
        else:
            d.setdefault(c, 1)
    ans = 1
    for key, value in d.items():
        ans = (ans * (value + 1)) % 1000000007
    print(ans)

ABC052C(int(input()))

Submission status: Accepted

Solution code:
n=int(input())
p_list=[]
m=1
for i in range(1,n+1):
  m*=i
  if i==1:
    pass
  elif i==2:
    p_list.append(2)
  else:
    div=0
    for j in p_list:
      if i%j==0:
        div+=1
        break
    if div==0:
      p_list.append(i)

ans=1
for i in p_list:
  s=0
  aaa=0
  while aaa==0:
    if m%i==0:
      s+=1
      m=m//i
    else:
      aaa+=1
  s+=1
  ans*=s

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

Submission status: Accepted

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

def count(N, p):
    cnt = 0
    while N != 0:
        cnt += N // p
        N //= p
    return cnt

N = int(input())
mod = 10 ** 9 + 7
Primes = primes(N)
ans = 1
for p in Primes:
    ans *= (count(N, p) + 1)
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
def isPrime(x):
    if x < 2:
        return 0
    elif x == 2:
        return 1
    if x%2 == 0:
        return 0
    ir=int(x**(0.5))+1
    for i  in range(3,ir,2) :
        if x%i == 0:
            return 0
    return 1

n=int(input())

p=[]
for i in range(n+1):
    if isPrime(i):
        p.append(i)

pp=[0]*len(p)
for ni in range(2,n+1):
    for pi in range(len(p)):
        pcnt=0
        nn=ni
        while nn>0:
            if nn%p[pi]==0:
                nn=nn//p[pi]
                pcnt+=1
            else:
                break
        pp[pi]=pp[pi]+pcnt
    
mod=10**9+7
ppp=1
for pi in range(len(p)):
    if pp[pi]!=0:
        ppp=ppp*(pp[pi]+1)%mod
print(ppp)

Submission status: Accepted

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

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(1, n+1):
    a = factorization(i)
    for i in range(len(a)):
        if a[i][0] not in dic:
            dic[a[i][0]] = 1
        else:
            dic[a[i][0]] += a[i][1]

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    dic = {}
    for i in range(2,n+1):
        a = i
        p = 2
        while p * p <= a:
            if a % p == 0:
                if p in dic:
                    dic[p] += 1
                else:
                    dic[p] = 1
                a //=p
            else:
                p += 1
        if a in dic:
            dic[a] += 1
        else:
            dic[a] = 1
    ans = 1
    #print(dic)
    for k,v in dic.items():
        ans *= (v+1)
    print(ans%mod)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

MAX = 2000
MOD = int(1e9) + 7
factors = [0] * MAX
primes = []


def p():
    ps = [True] * MAX

    for i in range(2, MAX):
        j = 2 * i
        if not ps[i]:
            continue
        primes.append(i)

        while j < MAX:
            ps[j] = False
            j += i


def fac(x):
    for p in primes:
        while x != 1 and x % p == 0:
            factors[p] += 1
            x //= p


N = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
N = int(input())
C = [0] * (N + 1)
for i in range(2, N+1):
    k = i
    for j in range(2, i+1):
        while k % j == 0:
            k //= j
            C[j] += 1
        if k == 1:
            break
ans = 1
for c in C:
    ans *= (c + 1)
    ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())

factors = defaultdict(int)
for i in range(2, n + 1):
    for j in range(2, i+1):
        while i % j == 0:
            factors[j] += 1
            i //= j
if n == 1:
    print(1)
else:
    a = '*'.join(str(value+1) for value in factors.values())
    print(eval(a)%(10**9+7))

Submission status: Accepted

Solution code:
import math
N = int(input())
prime=[]
count=[]
ans = 1
place = 0
t=10**9
t+=7
for k in range(1,N+1):
    for i in range(2,k+1):
        while k % i == 0:
            k //= i
            if(i in prime):
                count[prime.index(i)] += 1
            else:
                prime.append(i)
                count.append(1)
                place += 1
for j in range(0,place):
    ans *= (count[j]+1)
print(ans%t)

Submission status: Accepted

Solution code:
import math

N = int(input())

f = math.factorial(N)
i = 2
ans = 1
cnt = 0

while f != 1:
    if f % i == 0:
        f //= i
        cnt += 1
    else:
        ans *= (cnt + 1)
        cnt = 0
        i += 1


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

Submission status: Accepted

Solution code:
from collections import Counter


def factorization(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
            arr[i] += cnt

    if temp != 1:
        arr[temp] += 1

    if len(arr.keys()) == 0 and n != 1:
        arr[n] += 1


N = int(input())
arr = Counter()
for i in range(1, N + 1):
    factorization(i)

cnt = 1
MOD = 10 ** 9 + 7
for v in list(arr.values()):
    cnt *= (v + 1)
    cnt %= MOD

print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    x, mod = 1, 10**9 + 7
    for i in range(1, N + 1):
        x *= i
    result = 1

    for i in range(2, N + 1):
        cnt = 1
        while x % i == 0:
            x = x // i
            cnt += 1
        result *= cnt

    result = result % mod
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
data = int(input())
modu = 10 ** 9 + 7
n = 1
for i in range(2, data + 1):
  n *= i
count = 1
ans = 1
for i in range(2, data + 1):
  if n % i != 0:
    continue
  count = 1
  while n % i == 0:
    n //= i
    count += 1
  ans *= count
print(ans % modu)

Submission status: Accepted

Solution code:
#nの素因数分解を行い、リスト[[素因数,指数],....]を返す
# 2020 = 2^2 * 5^1 * 101^1
#[[2,2],[5,1],[101,1]
def prime_factorize(n):
    #返す配列
    res = []
    for i in range(2,n+1):
        #指数
        ex = 0
        # √Nまで行う
        if i * i > n:
            break
        if n % i != 0:
            continue
        #iで割り続ける
        while ( n % i == 0):
            ex += 1
            n /= i
        #その結果を追加
        res.append([i,ex])
    #最後に残った数について、1でなければ素数なのでリストに加える
    if n != 1:
        res.append([int(n),1])

    return res


N = int(input())
MOD = 1000000007
#exp[p] = 素因数pの指数
exp = [0] * (N+1)

for i in range(2,N+1):
    pf = prime_factorize(i)
    for j in range(len(pf)):
        exp[pf[j][0]] += pf[j][1]

ans = 1
for i in range(2,N+1):
    #約数の個数は(exp +1)の積
    ans *= exp[i] + 1
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

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

# nまでの自然数が素数かどうかを表すリストを返す
# Sieve of Eratosthenes
def makePrimeChecker(n):
    isPrime = [True] * (n + 1)
    isPrime[0] = False
    isPrime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if isPrime[i]:
            for j in range(i * i, n + 1, i):
                isPrime[j] = False
    return isPrime

ls = makePrimeChecker(n)
# print(ls)

# def make_divisors(n):
#     divisors = []
#     for i in range(1, int(n**0.5)+1):
#         if n % i == 0:
#             divisors.append(i)
#             if i != n // i:
#                 divisors.append(n//i)

#     # divisors.sort()
#     return divisors

ans = 1
for p in range(2,len(ls)):
    if ls[p]:
        i = 0
        count = 0
        while n>=(p**i):
            i += 1
            count += n//(p**i)
        ans *= count + 1
    else:
        pass

# ans2 = make_divisors(factorial(n))
# print(ans2)

print(ans%mod)

Submission status: Accepted

Solution code:
import math
n = int(input())
d = {}
       
for i in range(2,n+1):
  for j in range(2,i+1):
    while i%j == 0:
      i /= j
      if j in d:
        d[j] += 1
      else:
        d[j] = 2
ans = 1
for i in list(d.values()):
  ans *= i
print(ans%(10**9+7))

Submission status: Accepted

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

num = prime_factorize(math.factorial(N))
ans = 1
num_list = set(num)

mod = 10**9+7

for x in num_list:
    ans = ans*(num.count(x)+1)%mod
    
print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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


n = int(readline())
divisors = [1]
for i in range(1, n):
    divisors += prime_decomposition(i + 1)
counter = list(Counter(divisors).items())
ans = 1
mod = 10 ** 9 + 7
for k, v in counter:
    if k != 1:
        ans = (ans % mod) * ((v + 1) % mod) % mod
print(ans)

Submission status: Accepted

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

for m in range(1, n + 1):
    for i in range(2, int(m**0.5) + 1):
        while not m % i:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        if m in pf:
            pf[m] += 1
        else:
            pf[m] = 1

res = 1
for i, j in pf.items():
    res *= j + 1
print(res % mod)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2000)
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])
    # 上のループを通した後にtempが1じゃなかったら、だけど、nが素数以外にそんなケースある？
    if temp!=1:
        arr.append([temp, 1])
    
    # 素数だったときの処理
    if arr == []:
        arr.append([n,1])

    return arr

factor_dict = {}
for i in range(2,n+1):
    factor_ls = factorization(i)
    for factor in factor_ls:
        if not factor[0] in factor_dict.keys():
            factor_dict[factor[0]] = 0
        factor_dict[factor[0]] += factor[1]
       
num_factor = 1
for num in factor_dict.values():
    num_factor *= num + 1
print(num_factor % (10**9 + 7))

Submission status: Accepted

Solution code:
mod=10**9+7
N=int(input())
M=1
y=[1 for k in range(N)]
for k in range(2,N+1):
    for j in range(2,k+1):
        if k==1:
            break
        if k%j ==0:
            count=0
            while k%j==0:
                k=k//j
                count+=1
            y[j-1]+=count
ans=1
for k in range(len(y)):
    ans=ans*y[k]%mod
print(ans)

Submission status: Accepted

Solution code:
mod=10**9+7
N=int(input())
M=1
y=[1 for k in range(N)]
for k in range(2,N+1):
    for j in range(2,k+1):
        if k%j ==0:
            count=0
            while k%j==0:
                k=k//j
                count+=1
            y[j-1]+=count
ans=1
for k in range(len(y)):
    ans=ans*y[k]%mod
print(ans)

Submission status: Accepted

Solution code:
import sys

import numpy as np
def sieve_of_eratosthenes(n=10 ** 7):
  sieve = np.ones(n + 1); sieve[:2] = 0
  for i in range(2, int(np.sqrt(n)) + 1):
    if sieve[i]: sieve[i*2::i] = 0
  return sieve, np.flatnonzero(sieve)

is_prime, prime_numbers = sieve_of_eratosthenes()

def prime_factorize(n):
  res = dict()
  if n < 2: return res
  border = int(n ** 0.5)
  for p in prime_numbers:
    if p > border: break
    while n % p == 0: res[p] = res.get(p, 0) + 1; n //= p
    if n == 1: return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = dict()
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items(): res[p] = res.get(p, 0) + c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
  res = 1
  for c in prime_factorize_factorial(n).values():
    res *= c + 1; res %= MOD
  print(res)

if __name__ ==  '__main__':
  main()

Submission status: Accepted

Solution code:
import sys

def sieve_of_eratosthenes(n=5 * 10 ** 6):
  sieve = [1] * (n + 1); sieve[0] = sieve[1] = 0
  for i in range(2, int(n ** 0.5) + 1):
    if not sieve[i]: continue
    for j in range(i * 2, n, i): sieve[j] = 0
  prime_numbers = [i for i in range(2, n + 1) if sieve[i]]
  return sieve, prime_numbers

is_prime, prime_numbers = sieve_of_eratosthenes(10 ** 3)

def prime_factorize(n):
  res = dict()
  if n < 2: return res
  border = int(n ** 0.5)
  for p in prime_numbers:
    if p > border: break
    while n % p == 0: res[p] = res.get(p, 0) + 1; n //= p
    if n == 1: return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = dict()
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items(): res[p] = res.get(p, 0) + c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
  res = 1
  for c in prime_factorize_factorial(n).values():
    res *= c + 1; res %= MOD
  print(res)

if __name__ ==  '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

def sieve_of_eratosthenes(n=5 * 10 ** 6):
  sieve = [1] * (n + 1); sieve[0] = sieve[1] = 0
  for i in range(2, int(n ** 0.5) + 1):
    if not sieve[i]: continue
    for j in range(i * 2, n, i): sieve[j] = 0
  prime_numbers = [i for i in range(2, n + 1) if sieve[i]]
  return sieve, prime_numbers

is_prime, prime_numbers = sieve_of_eratosthenes(10 ** 3)

def prime_factorize(n):
  res = defaultdict(int)
  if n < 2: return res
  border = int(n ** 0.5)
  for p in prime_numbers:
    if p > border: break
    while n % p == 0: res[p] += 1; n //= p
    if n == 1: return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = defaultdict(int)
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items(): res[p] += c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
  res = 1
  for c in prime_factorize_factorial(n).values():
    res *= c + 1; res %= MOD
  print(res)

if __name__ ==  '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from bisect import bisect_right as bi_r

U = 5 * 10 ** 6
def sieve_of_eratosthenes(n=U):
  if n == 1: return set()
  sieve = set(range(2, n + 1))
  for p in sieve_of_eratosthenes(int(n ** 0.5)):
    sieve -= set(range(p * 2, n + 1, p))
  return sieve

prime_numbers = sieve_of_eratosthenes(10 ** 3)
soted_prime_numbers = sorted(prime_numbers)

def is_prime(n): return n in prime_numbers

def prime_factorize(n):
  res = defaultdict(int)
  if n < 2: return res
  for p in soted_prime_numbers[:bi_r(soted_prime_numbers, int(n ** 0.5))]:
    while n % p == 0:
      res[p] += 1
      n //= p
    if n == 1:
      return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = defaultdict(int)
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items():
      res[p] += c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
    res = 1
    for c in prime_factorize_factorial(n).values():
        res *= c + 1; res %= MOD
    print(res)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from bisect import bisect_right as bi_r

def sieve_of_eratosthenes(n=10 ** 6):
  if n == 1: return set()
  sieve = set(range(2, n + 1))
  for p in sieve_of_eratosthenes(int(n ** 0.5)):
    sieve -= set(range(p * 2, n + 1, p))
  return sieve

prime_numbers = sieve_of_eratosthenes()
soted_prime_numbers = sorted(prime_numbers)

def is_prime(n): return n in prime_numbers

def prime_factorize(n):
  res = defaultdict(int)
  if n < 2: return res
  for p in soted_prime_numbers[:bi_r(soted_prime_numbers, int(n ** 0.5))]:
    while n % p == 0:
      res[p] += 1
      n //= p
    if n == 1:
      return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = defaultdict(int)
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items():
      res[p] += c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
    res = 1
    for c in prime_factorize_factorial(n).values():
        res *= c + 1; res %= MOD
    print(res)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from functools import reduce
N=int(input())
MOD=10**9+7

def all_multiple(a):
    return reduce(lambda a,b:a*b,a)

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


A=[1]*(N+1)#indexと割られる数を合わせる
ans=1
for N_t in range(2,N+1):
    for num in range(1,N_t+1):
        if is_prime(num):
            cnt=0
            while N_t%num==0:
                N_t=N_t//num
                cnt+=1
            A[num]+=cnt 

print(all_multiple(A)%MOD)

Submission status: Accepted

Solution code:
import math
from functools import reduce
N=int(input())
MOD=10**9+7
'''
def all_multiple(a):
    return reduce(lambda a,b:a*b,a)
'''
def all_multiple_mod(a,m):
    return reduce(lambda a,b:((a%m)*(b%m))%m,a)




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


A=[1]*(N+1)#indexと割られる数を合わせる
ans=1
for N_t in range(2,N+1):
    for num in range(1,N_t+1):
        if is_prime(num):
            cnt=0
            while N_t%num==0:
                N_t=N_t//num
                cnt+=1
            A[num]+=cnt 

print(all_multiple_mod(A,MOD)%MOD)

Submission status: Accepted

Solution code:
import math
from functools import reduce
N=int(input())
MOD=10**9+7
'''
def all_multiple(a):
    return reduce(lambda a,b:a*b,a)
'''
def all_multiple_mod(a,m):
    return reduce(lambda a,b:((a%m)*(b%m))%m,a)

def is_prime(n):
    if n<=1 or (n!=2 and n%2==0):#nが１以下、あるいは、2ではない偶数
        return False
    elif 2<=n<=9:#n1が2以上９以下かつ2以外の偶数ではない
        return True
    else:#nが10以上の奇数〜√nまでの数で割り切れない場合は素数
        res=True
        for d in range(3,int(math.sqrt(n))+1,2):
            if n%d==0:
                res=False
                break
        return res
#print(is_prime(N))

'''
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
'''

A=[1]*(N+1)#indexと割られる数を合わせる
ans=1
for N_t in range(2,N+1):
    for num in range(1,N_t+1):
        if is_prime(num):
            cnt=0
            while N_t%num==0:
                N_t=N_t//num
                cnt+=1
            A[num]+=cnt 

print(all_multiple_mod(A,MOD)%MOD)

Submission status: Accepted

Solution code:
n=int(input())
s,ans,num =1,1,2
for i in range(2, n+1):
  s*=i
l=[]
while s!=1:
  if not s%num:
    l.append(num)
    s//=num
  else:
    num+=1
for i in set(l):
  ans*=l.count(i)+1
  ans%=10**9+7
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
import itertools
#from scipy.misc import comb

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

pf = [0]*(N+1)
for n in range(2,N+1):
    q = n
    i = 2
    while q>1:
        if q%i == 0:
            pf[i] += 1
            q /= i
        else:
            i += 1

ans = 1
for f in pf:
    ans = (ans*(f+1))%MOD

print(ans)

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  m = 1
  for _ in range(n,1,-1):
    m *= _
  
  cnt = 1
  for i in range(2,n+1):
    tmp = 1
    while m % i == 0:
      m //= i
      tmp += 1
    cnt *= tmp
  print(cnt%mod)
if __name__ == '__main__':
  main()

Submission status: Accepted

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