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:
#3問目
import math
from decimal import *
N = int(input())
MAX = 10 ** 9 + 7
result = 1

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

Soinsuu = [0] * (N + 1)
for i in range(1, N + 1):
    factorize = prime_factorize(i)
    for j in factorize:
        Soinsuu[j] += 1

for i in Soinsuu:
    if i != 0:
        result *= i+1

print(result % MAX)

Submission status: Accepted

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    # 素因数分解　10**12でもOK
    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 = ni()

    diver = []

    for i in range(2, n + 1):
        tmp = prime_factorize(i)
        diver.extend(tmp)

    c = collections.Counter(diver)

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter
from operator import mul
from functools import reduce

MOD = 10**9 + 7
def prime_factor(n):
    a = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            a.append(i)
            n = n//i
    if n != 1:
        a.append(n)
    return a

n = int(input())

factor = Counter()

for i in range(2, n+1):
    c = Counter(prime_factor(i))
    factor += c

ans = 1
for e in factor.values():
    ans *= (e+1)
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
from collections import Counter
MOD=10**9+7
#nの素因数分解(O(n**0.5)
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

ans=Counter()
for i in range(1,n+1):
  tmp=prime_factor(i)
  ans+=Counter(tmp)

res=1
for j in ans.values():
  res*=(j+1)
  res%=MOD
print(res%MOD)

Submission status: Accepted

Solution code:
def prime_factorize(N):
    a = 1
    i = 2
    while i * i <= N:
        cnt = 1
        while N % i == 0:
            cnt += 1
            N //= i
        a *= cnt
        i += 1
    if N > 1:
        a *= 2
    return a


def resolve():
    import math as m
    N = int(input())
    n = m.factorial(N)
    a = prime_factorize(n)
    print(a % (10**9 + 7))


resolve()

Submission status: Accepted

Solution code:
import math
N=math.factorial(int(input()))
A=N
i=2
ans=1
M=10**9+7
while N!=1:
    cnt=1
    while N%i==0:
        cnt+=1
        N//=i
    ans*=cnt
    i+=1

print(int(ans%M))

Submission status: Accepted

Solution code:
import math
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())
A = [0]*(10**3)
mod = 10**9+7
for i in range(2,N+1):
    for j in factorization(i):
        A[j[0]-1] += j[1]
ans = 1
for a in A:
    if a != 0:
        ans *= a+1
print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())


def solve(n, p):
    ans = 0
    cnt = 1
    tmp = 1
    while tmp >= 1:
        tmp = n // p**cnt
        ans += tmp
        cnt += 1
    return ans


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

primes = list(primes)


li = [solve(n, x) + 1 for x in primes]
mod = 10**9 + 7

ans = 1
for x in li:
    ans *= x
    ans %= mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
so = []

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(1,n+1):
    li = prime_factorize(i)
    so += li

so.sort()

from collections import Counter

c = Counter(so)
now = 1

for i,j in c.items():
    now *= (j+1)
    now %= 10**9+7

print(now)

Submission status: Accepted

Solution code:
import collections
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[i] = cnt
    if temp!=1:
        arr[temp] = 1
    if arr==[]:
        arr[n] = 1
    return arr


summary = collections.Counter()
for i in range(1, n+1):
    summary = summary + collections.Counter(factorization(i))

ans = 1
for j in summary.values():
    ans *= j + 1

print(ans % (pow(10, 9)+7))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    import math
    def prime_factorize1(N):
        """
        Nをくって、Nの素因数を格納したリストresを返す。
        リストの要素をすべて掛ければNになる"""
        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)
        return res
    if N==1:
        print(1)
    else:
        num=[]
        for i in range(2,N+1):
            l=prime_factorize1(i)
            num.extend(l)
        from collections import Counter
        c=Counter(num)
        ans=1
        for x in c.values():
            ans=(ans*(x+1))%(10**9+7)
        print(ans)
resolve()

Submission status: Accepted

Solution code:
class Sieve:
    """区間[2,n]の値を素因数分解する"""

    def __init__(self, n=1):
        primes = []
        f = [0] * (n + 1)
        f[0] = f[1] = -1
        for i in range(2, n + 1):  # 素数を探す
            if f[i]: continue
            primes.append(i)
            f[i] = i  # 素数には自身を代入
            for j in range(i * i, n + 1, i):  # 合成数に素因数を書き込む
                if not f[j]:
                    f[j] = i  # 最小の素因数を代入
        self.primes = primes
        self.f = f

    def is_prime(self, x) -> bool:  # 素数判定
        return self.f[x] == x

    def factor_list(self, x) -> list:  # 素因数分解の昇順リスト, [2,2,3,5,...]
        res = []
        while x != 1:
            res.append(self.f[x])
            x //= self.f[x]
        return res

    def factor(self, x) -> list:  # 素因数分解の頻度リスト, [[2,x],[3,y],[5,z],...]
        fl = self.factor_list(x)
        if not fl: return []
        res = [[fl[0], 0]]
        for p in fl:
            if res[-1][0] == p:
                res[-1][1] += 1
            else:
                res.append([p, 1])
        return res


def main():
    from collections import Counter

    MOD = 10 ** 9 + 7

    N = int(input())

    sv = Sieve(n=N)

    ctr = Counter()
    for x in range(1, N + 1):
        ctr.update(sv.factor_list(x))

    ans = 1
    for cnt in ctr.values():
        ans = ans * (cnt + 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
#素因数分解
def prime_factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
N = int(input())
ls = []
#コーナーケース
if N == 1:
    print(1)
else:
    for i in range(1,N+1):
      #1~Nの、それぞれで素因数分解した結果を1つのリストにする。
        ls.extend(prime_factorization(i))
    ls.sort()
    ans = 1 # ansはN!の約数の個数
    now = 1 # nowは現在の連続数
    now_2 = 0 #now_2は現在参照対象の数
    for i in range(len(ls)):
        if i == 0:
            now_2 = ls[i]
        else:
            if ls[i] == now_2:
                now += 1
            else:
                ans *= (now+1)
                now = 1
                now_2 = ls[i]
    ans *= (now+1)
    print(ans%(10**9+7))

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

#素因数分解
def prime_factorize(n):
    if n == 1:
        return [1]
    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 = inp()
d = defaultdict(int)
for i in range(2,n+1):
    pp = prime_factorize(i)
    for x in pp:
        d[x] += 1
res = 1
# print(d)
for va in d.values():
    res *= va+1
    res %= mod
print(res)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
#nまでの素因数を列挙してp^a+q^b+...となるとき、正の約数は
#
def factorization(n,dic):
    tmp=n
    flag = True
    for i in range(2,int(-(-n**0.5//1))+1):
        if tmp%i==0:
            flag = False
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            dic[i]=dic.get(i,0)+cnt
    if tmp!=1:
        flag = False
        dic[tmp]=dic.get(tmp,0)+1
    if flag:
        dic[n]=dic.get(n,0)+1
    return dic

dic = {}
for i in range(1,n+1):
    dic = factorization(i,dic)

if len(dic)==1:
    print(1);exit()

tmp = 1
for k,v in dic.items():
    if k!=1:
        tmp=tmp*(v+1)%mod
print(tmp)

Submission status: Accepted

Solution code:
from collections import Counter

def factorization(n):
    d = Counter()
    m = 2
    while m ** 2 <= n:
        while n % m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

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

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

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
    print(1)
    exit()
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

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
num=0
divs=[0]*(N+1)
for i in range(2,N+1):
    l=factorization(i)
    for t in l:
        divs[t[0]]+=t[1]
p=10**9+7
#print(divs)
ans=1
for a in divs:
    if a>=1:
        ans*=(a+1)
        ans%=p
print(ans)

Submission status: Accepted

Solution code:
import math
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
#約数列挙
N = int(input())
ls = []
if N == 1:
    print(1)
else:
    for i in range(1,N+1):
        ls.extend(factorization(i))
    ls.sort()
    ans = 1
    now = 1
    now_2 = 0
    for i in range(len(ls)):
        if i == 0:
            now_2 = ls[i]
        else:
            if ls[i] == now_2:
                now += 1
            else:
                ans *= (now+1)
                now = 1
                now_2 = ls[i]
    ans *= (now+1)
    print(ans%(10**9+7))

Submission status: Accepted

Solution code:
# 素因数分解
def f(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
cnt = [0] * (n+1)

for i in range(1, n+1):
    F = f(i)
    for j in range(len(F)):
        cnt[F[j][0]] += F[j][1]

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

print(ans)

Submission status: Accepted

Solution code:
from math import factorial
# 素因数分解
def f(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
fn = factorial(n)
# f = f(fn)
cnt = [0] * (n+1)

for i in range(1, n+1):
    # cnt[f[i][0]] += f[i][1]
    F = f(i)
    for j in range(len(F)):
        cnt[F[j][0]] += F[j][1]

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

print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    return res


def resolve():
    n = int(input())

    P = [0] * 1000
    for i in range(1, n + 1):
        t = prime_factorization(i)
        for num, ex in t:
            P[num] += ex

    res = 1
    for p in P:
        res *= p + 1
        res % mod

    print(res % mod)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

from collections import Counter, defaultdict
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
    
allcount = defaultdict(int)

for n in range(1,N+1):
    a = prime_factorize(n)
    c = Counter(a)
    for k,v in c.items():
        allcount[k] += v

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

print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
  """
  引数の値を素因数分解したリストを返す

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

  Returns
  -------
  retlist : list
      2以上の整数n => [[素因数, 指数], ...]の2次元リスト
  """
  retlist = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      retlist.append([i, cnt])

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

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

  return retlist

n=int(input())
mod=10**9+7
from collections import Counter
c=Counter()
ans=1
for i in range(2,n+1):
  d=factorization(i)
  for k,v in d:
    c[k]+=v
for v in c.values():
  ans*=v+1
  ans%=mod
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
import math
from collections import defaultdict
dic = defaultdict(int)


def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] += count
    if k != 1: #sqrt(k)までチェックしてもkが1になっていない --> kが素因数
        dic[k] += 1

N = int(input())

for i in range(1, N + 1):
    factoring(i)

ans = 1
for i in dic:
    ans *= (dic[i] + 1)
    ans %= MOD

print (ans)

Submission status: Accepted

Solution code:
import sys
import collections

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
MOD = 10 ** 9 + 7


def solve():
    fs = collections.Counter()
    for n in range(2, N + 1):
        i = 2
        while i * i <= n:
            while n % i == 0:
                n //= i
                fs[i] += 1
            i += 1
        if n > 1:
            fs[n] += 1

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

    return ans


print(solve())

Submission status: Accepted

Solution code:
import collections
n=int(input())
#a,b=map(int,input().split())
#a=list(map(int,input().split()))
#n=int(input())
#s=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
d=[0]*1000

for i in range(n,1,-1):
  for j in prime_factorize(i):
    d[j]+=1
ans=1

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

Submission status: Accepted

Solution code:
from collections import defaultdict
N = int(input())
mod = 10 ** 9 + 7

res = defaultdict(int)
for n in range(2, N + 1):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            res[i] += cnt
    if n > 1:
        res[n] += 1

ans = 1
for x in res.values():
    ans *= (x + 1)
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
mod=10**9+7
n=int(input())
l=[0]*(n+1)
for i in range(2,n+1):
    c=Counter(prime_factorize(i)).items()
    for a,b in c:
        l[a]+=b
ans=1
for v in l:
    ans*=(v+1)
    ans=ans%mod
print(ans%mod)

Submission status: Accepted

Solution code:
N = int(input())

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

fs = Counter()
for i in range(1,N+1):
    fs += factorize(i)

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

Submission status: Accepted

Solution code:
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
  
import sys
readline = sys.stdin.readline

N = int(readline())
from collections import defaultdict
dic = defaultdict(int)

for i in range(2,N + 1):
  arr = factorization(i)
  for a in arr:
    dic[a[0]] += a[1]

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

Submission status: Accepted

Solution code:
from math import sqrt
from collections import defaultdict
from itertools import product
import sys

n = int(input())
h = defaultdict(int)
def factorization(arg):
    while arg % 2 == 0:
        h[2] += 1
        arg //= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            h[i] += 1
            arg //= i
    if arg > 1:
        h[arg] += 1
if n == 1:
    print(1)
else:
    m = 10 ** 9 + 7
    for i in range(1, n + 1):
        factorization(i)
    cnt = 1
    for key, v in h.items():
        cnt *= (v + 1)
        cnt %= m
    print(cnt)

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 15
mod = 10 ** 9 + 7

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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())
judge = [1 for i in range(10**3)] # 素数が何個あるか
for i in range(n,1,-1):
    tmp = factorization(i)
    for v,num in tmp:
        judge[v]+=num
ans = 1
for num in judge[2:]:
    ans = (ans*num)%mod
print(ans)

Submission status: Accepted

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


def factfact(n):
    res = []
    prime = [0] * (n + 1)
    for i in range(2, n + 1):
        prime[i] = 1

    for i in range(2, n + 1):
        if prime[i]:
            j = i * 2
            while j <= n:
                prime[j] = 0
                j += i

    for i in range(2, n + 1):
        if prime[i]:
            prime[i] = 0
            j = i
            while j <= n:
                prime[i] += n // j
                j *= i
            # print(i, prime[i])
            res.append([i, prime[i]])
    return res


prime_list = factfact(N)
ans = 1
# print(prime_list, len(prime_list))
for i in range(len(prime_list)):
    ans *= (prime_list[i][1] + 1) % MOD
print(ans % MOD)

Submission status: Accepted

Solution code:
import sys
import collections

sys.setrecursionlimit(10**6)
MOD = pow(10,9)+7

def kaijo(n):
    if n <= 1:
        return 1
    else:
        return n * kaijo(n-1)

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

def make_divisors(n):
    divisors = []
    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)
    return divisors

def main():
    N = int(input())
    if N == 1:
        print(1)
        return
    counter = collections.Counter([])
    for n in range(N, 0, -1):
        counter += collections.Counter(prime_factorize(n))
    items = list(zip(*counter.items()))
    ans = 1
    for i in items[1]:
        ans *= i+1
        ans %= MOD
    print(ans)

    #n = kaijo(N)
    #print(n)
    #m = make_divisors(n)
    ##m.sort()
    #print(m)
    #print(len(m)%MOD)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import Counter
from math import sqrt, ceil
MOD = 10**9+7
n = int(input())
p_list = []

for i in range(2, n+1):
    target = i
    for j in range(2, ceil(sqrt(i))+1):
        while target % j == 0:
          p_list.append(j)
          target //= j
    if target != 1:
        p_list.append(target)

res = 1
for v in Counter(p_list).values():
    res *= (v+1)
    res %= MOD
print(res)

Submission status: Accepted

Solution code:
import math
mod = 10**9+7
n = int(input())
n = math.factorial(n)
ans = 1
i = 2
while i*i<=n:
    cnt = 1
    while n % i == 0:
        cnt += 1
        n //= i
    i = i + 1
    ans = ans*cnt

if n != 1:
    ans = ans*2
print(ans%mod)

Submission status: Accepted

Solution code:
from collections import defaultdict
MOD = 10**9+7
n = int(input())


def sieve(n):
    n += 1
    res = [i for i in range(n)]
    for p in range(2, int(n**.5)+1):
        if res[p] < p:
            continue
        for q in range(p**2, n, p):
            if res[q] == q:
                res[q] = p
    return res


U = 10**3
min_factor = sieve(U)
pf = defaultdict(lambda: 0)


def prime_factor(n):
    while 1 < n:
        pf[min_factor[n]] += 1
        n //= min_factor[n]


for i in range(1, n+1):
    prime_factor(i)

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

Submission status: Accepted

Solution code:
mod = 10 ** 9 + 7
d = {}


def prime_factorizer(n):
    i = 2
    global d
    while i * i <= n:
        if n % i == 0:
            if i in d.keys():
                d[i] += 1
            else:
                d.setdefault(i, 1)
            n //= i
        else:
            i += 1
    if n != 1:
        if n in d.keys():
            d[n] += 1
        else:
            d.setdefault(n, 1)


n = int(input())

for i in range(n, 0, -1):
    prime_factorizer(i)

cnt = 1
for k, v in d.items():
    cnt *= v + 1
print(cnt % mod)

Submission status: Accepted

Solution code:
n=int(input())
import math
n=math.factorial(n)
ans=1
i=2
while i*i<=n:
  count=1
  while n%i==0:
    count=count+1
    n=n//i
  i=i+1
  ans=ans*count
if n!=1:
  ans=ans*2
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
from collections import defaultdict

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

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

cnt = defaultdict(int)
for i in range(1,n+1):
    res = prime_factorize(i)
    for j, v in res:
        cnt[j] += v

ans = 1
for i, v in cnt.items():
    ans *= (v+1)
print(ans % mod)

Submission status: Accepted

Solution code:
def main():
    from sys import stdin
    N = int(stdin.readline())
    P = 10**9+7
    
    def sieve_of_eratosthenes(upper_bound):
        upper_bound += 1
        P = [True] * upper_bound
        P[0] = P[1] = False
        for i in range(4,upper_bound,2):
            P[i] = False
        for i in range(3,int(upper_bound**0.5),2):
            if P[i]:
                for j in range(i**2,upper_bound,i):
                    P[j] = False
        res = []
        for i in range(upper_bound):
            if P[i]:
                res.append(i)
        return res
    
    primes = sieve_of_eratosthenes(N)
    num_p = [0]*len(primes)

    ans = 1
    for i in range(2,N+1):
        for j,p in enumerate(primes):
            while i % p == 0:
                i //= p
                num_p[j] += 1
            if i == 1:
                break
            
    ans = 1
    for p in num_p:
        ans = ans * (p+1) % P
    print(ans)
main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def factorization(n):
    global d, mod
    temp = n
    flag = True
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            flag = False
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            d[i] += cnt
            d[i] %= mod

    if temp!=1:
        flag = False
        d[temp] += 1
        d[temp] %= mod

    if flag:
        d[n] += 1
        d[n] %= mod

    return


d = defaultdict(int)
N = int(input())
mod = 10**9 + 7
for i in range(2, N+1):
    factorization(i)

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

print(ans)

Submission status: Accepted

Solution code:
import math

# 素因数分解
def f(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
ans = 1
cnt = [0] * (n+1)

for i in range(2,n+1):
    fac = f(i)
    for j in range(len(fac)):
        cnt[fac[j][0]] += fac[j][1]

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

Submission status: Accepted

Solution code:
from collections import defaultdict


def min_factor(n):
    sieve = list(range(n + 1))
    sieve[2::2] = [2] * (n // 2)
    for i in range(3, int(n ** 0.5) + 2, 2):
        if sieve[i] == i:
            sieve[i * i::2 * i] = [i] * ((n - i * i) // (2 * i) + 1)
    return sieve


def prime_factorize(n, table):
    a = {}
    while n != 1:
        b = table[n]
        if b in a:
            a[b] += 1
        else:
            a[b] = 1
        n //= b
    return a


def main():
    n = int(input())
    mod = 10 ** 9 + 7
    table = min_factor(10 ** 3)

    dic = defaultdict(int)
    for i in range(1, n + 1):
        for key, value in prime_factorize(i, table).items():
            dic[key] += value

    res = 1
    for value in dic.values():
        res *= value + 1
        res %= mod
    print(res)


if __name__ == '__main__':
    main()