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:
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
n = int(input())
cnt = [0]*10000
sum = []
for i in range(2, n + 1):
    sum += prime_factorize(i)

for x in sum:
    cnt[x] += 1
ans = 1
for i in range(len(cnt)):
    if cnt[i] > 0:
        ans *= (cnt[i]+1)
print(ans % MOD)

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist
ex={}
mod=10**9+7
for i in range(2,n+1):
    res=prime_factorize(i)
    for p,e in res:
        ex[p]=ex.get(p,0)+e

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

Submission status: Accepted

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

# 素数
primes = [True] * (n + 1)
p = 2
while p * p <= n:
    if primes[p]:
        for i in range(p * p, n + 1, p):
            primes[i] = False
    p += 1
primes[0], primes[1] = False, False

# counter
cnt = [0] * (n + 1)
for k in range(2, n + 1):
    now = k
    # 素因数分解
    for i in range(2, k + 1):
        while k % i == 0:
            cnt[i] += 1
            k //= i
    if k != 1:
        cnt[k] += 1

res = 1
for k in range(1, n + 1):
    if primes[k]:
        res *= cnt[k] + 1
        res %= MOD

print(res)

Submission status: Accepted

Solution code:
"""
1~Nまでを素因数分解して、素因数の数を足し合わせればよい。
計算量としては、O(N*√N)
"""
from collections import Counter
N = int(input())
count = Counter([])
for i in range(1,N+1):
    tmp = []
    d = 2
    while d**2 <= i:
        if i%d == 0:
            i //= d
            tmp.append(d)
        else:
            d += 1
    if i != 1:
        tmp.append(i)
    count += Counter(tmp)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

def prime_factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**0.5)+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
primes=defaultdict(int)
for n in range(1,N+1):
    for num,cnt in prime_factorization(n):
        primes[num]+=cnt

ans=1
for n,cnt in primes.items():
    if n==1:
        continue
    ans*=cnt+1
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = {}
ans = 1

for i in range(2, n + 1):
    for j in range(2, i + 1):
        if i%j == 0:
            cnt = 0
            while i%j == 0:
                i //= j
                cnt += 1
            if j in l:
                v = l[j]
                l[j] = cnt + v
            else:
                l[j] = cnt
for i in l.values():
    ans = ans*(i + 1)%(10**9 + 7)

print(ans)

Submission status: Accepted

Solution code:
import math
import collections

n = int(input())

factorial = 1
divisor = []
ans = 1


# 素数を求める関数
def get_prime(num):
    if num <= 1:
        return
    for i in range(2, num+1):
        while num % i == 0:
            divisor.append(i)
            num //= i


# 約数の数 = (素数xの個数+1)(素数yの個数+1)(素数zの個数+1)...
# 方針：入力値を素因数分解し、各素因数の個数を求める

# n-iの素因数を求める
for j in range(2, n+1):
    get_prime(j)

# print(divisor)

# 各素因数の組み合わせ数を求める
count = collections.Counter(divisor)

for k in count.most_common():
    temp = list(k)[1]
    ans = ans * (temp + 1)

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

print(ans)

Submission status: Accepted

Solution code:
# エラトステネスの篩, 素因数分解
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


def prime_factorize(n):
    result = []
    while n != 1:
        p = prime_table[n]
        c = 0
        while n % p == 0:
            n //= p
            c += 1
        result.append((p, c))
    return result


N = int(input())

m = 1000000007

prime_table = make_prime_table(N)

t = [0] * (N + 1)
for i in range(2, N + 1):
    for p, e in prime_factorize(i):
        t[p] += e

result = 1
for i in range(2, N + 1):
    if t[i] == 0:
        continue
    result = result * (t[i] + 1) % m
print(result)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

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


def main():
	n = I()
	divisors_dict = {}
	for i in range(2,n+1):
		tmp_divisors = factorization(i)
		for tmp_divisor, num in tmp_divisors:
			if tmp_divisor in divisors_dict:
				divisors_dict[tmp_divisor] += num
			else:
				divisors_dict[tmp_divisor] = num
	ans = 1
	for divisor_num in divisors_dict.values():
		ans *= (divisor_num + 1)
		ans %= MOD
	print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys;input = lambda : sys.stdin.readline()
import collections
N = int(input())
d = collections.Counter()
if N == 1:
    print(1)
else:
    for n in range(2, N + 1):
        while n % 2 == 0:
            d[2] += 1
            n //= 2
        i = 3
        while i * i <= n:
            if n % i == 0:
                while n % i == 0:
                    d[i] += 1
                    n //= i
            i += 2
        if n > 1:
            d[n] += 1
    ans = 1
    for k, v in d.items():
        ans = (ans * (v + 1)) % 1000000007
    print(ans)

Submission status: Accepted

Solution code:
import sys


# import math
# import heapq

# input = sys.stdin.readline
# import defaultdict


def main():
    N = int(input())
    ans = 1
    q = [1] *(N+1)
    for i in range(1, N + 1):
        k = i
        for j in range(2, i + 1):
            while k % j == 0:
                k /= j
                q[j] += 1

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
if n==1:
    print(1)
    exit()
l=[0]*(n+1)#約数0~1000の各総数
for i in range(2,n+1):
    x=i
    j=2
    while j<n+1:
        if x%j==0:
            x//=j
            l[j]+=1
        else:
            j+=1
#print(l)
ans=1
for i in range(len(l)):
    ans*=(l[i]+1)
    ans%=(10**9 +7)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 1
q = [1 for i in range(N + 1)]
for i in range(2,N + 1):
    k = i
    for i2 in range(2,i + 1):
        while k % i2 == 0:
            k /= i2
            q[i2] += 1
            
for i in range(N + 1):
    ans *= q[i]
    ans %= 10 ** 9 + 7

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def factorize(N):
    res = {}
    for i in range(2, N):
        if i**2 > N: break
        if N % i != 0: continue
        num = 0
        while N % i == 0:
            N = int(N/i)
            num += 1
        res[i] = num
    if N>1: res[N] = 1
    return res

MOD = 10**9+7
table = [0]*(N+1)
for i in range(2, N+1):
    res = factorize(i)
    for p in res.keys():
        table[p] += res[p]
        table[p] %= MOD

ans = 1
for n in table:
    if n > 0: 
        ans *= (1+n)
        ans %= MOD

print(ans)

Submission status: Accepted

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

def factors(N):
    factors = []
    while N%2 == 0:
        factors.append(2)
        N //=2

    for f in range(3, int(N**0.5)+ 1, 2):
        while N%f == 0:
            factors.append(f)
            N //= f
    if N != 1:
        factors.append(N)
    return factors

cd = dict()
for i in range(1, n+1):
    facs = factors(i)
    for f in facs:
        cd.setdefault(f, 0)
        cd[f] += 1

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

print(ans)

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
m=int(input())
def factorize(n):
    fct={}
    temp=n
    if temp<4:
        fct[temp]=1
    else:
        e=0
        while temp%2==0:
            temp=temp//2
            e+=1
        if e>0:
            fct[2]=e
    
    for b in range(3,int(n**0.5)+1,2):
        e=0
        while temp%b == 0:
            temp=temp//b
            e+=1
        if e>0:
            fct[b]=e
    if temp!=1:
        fct[temp]=1
    return fct
res={}
for i in range(2,m+1):
    f=factorize(i)
    for j in f:
        if j not in res:
            res[j]=f[j]
        else:
            res[j]+=f[j]
ans=1
for i in res.values():
   
    ans*=(i+1)
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input())

# 素因数分解 (dictバージョン)
# 考え方：1~√nまで実際に割れるか試せば良いが、割れた場合は割れる限りその数で割り続ける
# 計算量：O(√n)
def prime_factorize(n, primes):
    i = 2
    while i * i <= n:
        if n % i != 0:
            i += 1
            continue
        exp = 0
        while n % i == 0:
            exp += 1
            n = n // i
        if i not in primes:
            primes[i] = exp
        else:
            primes[i] += exp
        i += 1
    # 最後に残った数は1か素数にしかならない
    if n != 1:
        if n not in primes:
            primes[n] = 1
        else:
            primes[n] += 1
    return primes


primes = {}
for k in range(1, N+1):
        primes = prime_factorize(k, primes)
count = 1
for p in primes:
    count *= (primes[p] + 1)
ans = count % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter

    n = int(readline())
    factors = Counter()

    for i in range(2, n + 1):
        x = i
        for j in range(2, int(i ** 0.5) + 5):
            while x % j == 0:
                factors[j] += 1
                x //= j
        if x != 1:
            factors[x] += 1

    ans = 1

    for key, val in factors.items():
        ans *= (val + 1)
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter
from math import factorial
N = int(input())
MOD = 10 ** 9 + 7

def prime(n):
    b = 2
    while b * b <= n:
        while n % b == 0:
            n //= b
            a.append(b)
        b += 1
    if n > 1:
        a.append(n)

a = []
prime(factorial(N))
A = Counter(a)
X = 1
for k, v in A.items():
    X *= (v + 1) % MOD
print(X % MOD)

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())
ans=[1 for i in range(n+1)]
mod=10**9+7
tmp=1
for i in range(2,n+1):
    t=f(i)
    for j,k in t:
        ans[j]+=k
for i in range(n+1):
    tmp=tmp*ans[i]%mod
print(tmp)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

prime_factories = [0] * (n+1)
for i in range(2, n+1):
    j = 2
    while j ** 2 <= i:
        ext = 0
        while i % j == 0:
            ext += 1
            i //= j
        if ext:
            prime_factories[j] += ext
        j += 1
    if i != 1:
        prime_factories[i] += 1
ans = 1
# 合成数のnumは0、num+1=1の乗算は計算結果に影響しない
for num in prime_factories:
    ans = (ans * (num + 1)) % MOD
print(ans)

Submission status: Accepted

Solution code:
d={}
for i in range(int(input())+1):
  for j in d:
    while i%j<1: d[j]+=1; i//=j
  if i>1: d[i]=2
a=1
for v in d.values(): a=a*v%(10**9+7)
print(a)

Submission status: Accepted

Solution code:
n=int(input())
d={}
for x in range(2,n+1):
  while x%2<1:
    x//=2
    d[2]=d.get(2,0)+1
  for i in range(3,int(x**0.5)+1,2):
    while x%i<1:
      x//=i
      d[i]=d.get(i,0)+1
    if x<2: break
  if x>1: d[x]=d.get(x,0)+1
a=1
for v in d.values(): a=a*(v+1)%(10**9+7)
print(a)

Submission status: Accepted

Solution code:
from collections import defaultdict


# 素因数分解
d = defaultdict(int)


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


N = int(input())
MOD = int(1e9) + 7
ans = 1
for i in range(1, N+1):
    prime_factorize(i)
for v in d.values():
    ans = ans * (v + 1) % 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

N=int(input())
mod=10**9+7
if N==1:
  print(1)
else:
  ans=1
  dp=[0]*1001
  for i in range(2,N+1):
    p=factorization(i)
    for i,j in p:
      dp[i]+=j
  for i in range(1001):
    ans*=(dp[i]+1)
    ans%=mod
  print(ans)

Submission status: Accepted

Solution code:
mod=10**9+7
import math
n=int(input())
ans=1
l=[0]*n
for ii in range(2,n+1):
  i=ii
  for j in range(2,int(math.sqrt(i))+1):
    if i%j==0:
      cnt=0
      while  i%j==0:
        cnt+=1;i//=j
      l[j-1]+=cnt
  if i!=1:
    l[i-1]+=1
for i in l:
  ans*=(i+1)
  ans%=mod
print(ans)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

def sieve(n):
    srn = int(n ** 0.5) + 1
    f = [False] * (srn + 1)
    res = []
    for i in range(2, srn + 1):
        if f[i]:
            continue
        res.append(i)
        for j in range(2 * i, srn + 1, i):
            f[j] = True
    return res

def trial_division(n):
    res = dict()
    for i in range(2, n+1):
        m = i
        for p in pn:
            while m % p == 0:
                res[p] = res.get(p, 0) + 1
                m //= p
            if m == 1:
                break
        if m > 1:
            res[m] = res.get(m, 0) + 1
    return res

N = int(input())
pn = sieve(N)
fn = trial_division(N)
res = 1
for f in fn.values():
    res *= (f + 1)
    res %= MOD
print(res)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

def sieve(n):
    srn = int(n ** 0.5) + 1
    f = [False] * (srn + 1)
    res = []
    for i in range(2, srn + 1):
        if f[i]:
            continue
        res.append(i)
        for j in range(2 * i, srn + 1, i):
            f[j] = True
    return res

def trial_division(n):
    res = dict()
    for i in range(2, n+1):
        m = i
        pn = sieve(m)
        for p in pn:
            while m % p == 0:
                res[p] = res.get(p, 0) + 1
                m //= p
        if m > 1:
            res[m] = res.get(m, 0) + 1
    return res

N = int(input())
fn = trial_division(N)
res = 1
for f in fn.values():
    res *= (f + 1)
    res %= MOD
print(res)

Submission status: Accepted

Solution code:
import math

def is_prime(n):
    if(n == 1):
        return False
    
    for i in range(2, int(math.sqrt(n))+1):
        if(n%i == 0):
            return False
        
    return True

sosu = []
for i in range(1, 1001):
    if(is_prime(i)):
        sosu.append(i)    

N = int(input())
mod = 10**9+7
x = math.factorial(N)
a = 1

for i in range(len(sosu)):
    cnt = 0
    if(sosu[i] > x):
        break
    while (x%sosu[i]==0):
        x = x//sosu[i]
        cnt += 1
    if(cnt):
        a *= (cnt+1)
        a %= mod

print(a)

Submission status: Accepted

Solution code:
import collections

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

l = []
for n in range(N):
  l.extend(prime_factorize(n+1))

c = collections.Counter(l)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
MOD = 10 ** 9 + 7
prime_factors = dict()

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

ans = 1
for pf in prime_factors:
    ans = (ans * (prime_factors[pf] + 1)) % MOD
print(ans)

Submission status: Accepted

Solution code:
from math import floor
large_p = 10**9 + 7
from operator import mul
from functools import reduce
def main():
    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())
    n_sq = floor(n ** 0.5)
    divs = [1] * (n + 1)
    for i1 in range(n , 1, -1):
        div = factorization(i1)
        for dive, divnum in div:
            divs[dive] += divnum
    r = reduce(mul, divs)
    r %= large_p

    print(r)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        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())

m = 1000000007

t = [0] * (N + 1)
for i in range(2, N + 1):
    for p, e in prime_factorize(i):
        t[p] += e

result = 1
for i in range(2, N + 1):
    if t[i] == 0:
        continue
    result = result * (t[i] + 1) % m
print(result)

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

n = int(input())
mod = 1_000_000_007
d = {}
for i in range(2,n+1):
    l = factorization(i)
    for item in l:
        d[item[0]] = d.get(item[0],0)+item[1]
ans = 1
for j in d.values():
    ans *= j+1
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter


def prime_factorization(n):
    """
    nを素因数分解して素因数のリストを返却する
    """
    if n < 2:
        return [n]

    primes = []
    while n % 2 == 0:
        primes.append(2)
        n //= 2
    i = 3
    while i ** 2 <= n:
        while n % i == 0:
            primes.append(i)
            n //= i
        i += 2
    if n != 1:
        primes.append(n)
    return primes


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

counter = Counter()

for n in range(2, N + 1):
    for p in prime_factorization(n):
        counter[p] += 1

ans = 1
for k, v in counter.items():
    if k < 2:
        continue
    ans *= v + 1
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
def soin(n):
	ans=[]
	l=int(n**0.5)+1
	for i in range(2,l+1):
		if n%i==0:
			a=[i,0]
			while n%i==0:
				n//=i
				a[1]+=1
			ans+=[a]
	if n>1:
		ans+=[[n,1]]
	return ans
d={}
n=int(input())
for i in range(2,n+1):
	a=soin(i)
	for j in a:
		if j[0] in d:
			d[j[0]]+=j[1]
		else:
			d[j[0]]=j[1]
k=1
for i in d.values():
	k*=(i+1)
print(k%(10**9+7))

Submission status: Accepted

Solution code:
n = int(input())
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]])
    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
            for _ in range(cnt):
                arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)
    
    return arr 
if n == 1:
    print(1)
else:
    di = [1]*1000
    for i in range(2,n+1):
        a = factorization(i)
        for j in a:
            di[j-1] += 1
    p = 1
    for k in di:
        p *= k
        if p >= 10**9+7:
            p %= 10**9+7
    print(p)

Submission status: Accepted

Solution code:
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())
cnt = [0]*1001
div = []
for i in range(2, n+1):
    div += prime_factorize(i)

for x in div:
    cnt[x] += 1

m = 1
for i in range(len(cnt)):
    if cnt[i] > 0:
        m *= (cnt[i]+1)
print(m % (10**9+7))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
Mod = 10 ** 9 + 7

# 素因数分解(prime factorize)
def prime_factorize(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(readline())

p_list = [0] * (n + 1)

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

ans = 1
for j in p_list:
    if j >= 1:
        ans *= (j + 1)
        ans %= Mod
print(ans)

Submission status: Accepted

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

from collections import Counter
N = int(input())
c = Counter([])
ans = 1
for i in range(1,N+1):
    c = c + Counter(prime_factorize(i))
for x in c.values():
    ans = (ans*(x+1)) % 1000000007
print(ans)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
def prime_factorize(n):
    prime_numbers = []
    for p in range(2, int(math.sqrt(n)+1)):
        if n % p != 0:
            continue
        while n % p == 0:
            n /= p
            prime_numbers.append(p)

    if n != 1:
        prime_numbers.append(n)
    return prime_numbers

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

    counter = defaultdict(int)
    for i in range(N,0,-1):
        primes = prime_factorize(i)
        for prime in primes:
            counter[prime] += 1

    ans = 1
    for prime, count in counter.items():
        ans *= count + 1
    
    print(ans % MOD)

if __name__ == '__main__':
    solve()

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

N = int(input())
num = 1
mod = 10**9+7
l = [0]*(N+1)
for n in range(2,N+1):
  F = factorization(n)
  for a,b in F:
    l[a] += b
count = 1
for i in range(2,N+1):
  if l[i] != 0:
    count *= (1+l[i])
print(count%mod)

Submission status: Accepted

Solution code:
from collections import defaultdict

res = defaultdict(lambda: 0)
#素因数分解O(√n)
def primeFactor(n):
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            res[i] += 1
            n = n // i
    if n != 1:
        res[n] += 1

N = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
class Factorization:	
	def __init__(self):
		# privateなインスタンス変数を作成
		self.__factors = dict()
		self.__n = 0
	
	
	def get_factors(self, n):
		# [summary] 素因数分解した結果を、辞書([素因数, 指数]...)で返す
		self.__factors.clear()
		self.__n = n
		
		if n < 2:
			# 2より小さい数の場合、素因数分解できない
			return { n:1 }
		else:
			self.__factorization()
			
			return self.__factors
	
	
	def get_divisors(self, n):
		# [summary] 約数をリスト化して返す
		self.__factors.clear()
		self.__n = n
		
		
	def count_divisors(self, n):
		# [summary] 約数の個数を返す
		self.__factors.clear()
		self.__n = n
		
		if n < 2:
			return 1
		else:
			self.__factorization()
			count = 1
			
			for v in self.__factors.values():
				count *= v + 1
			
			return count
	

	def	__factorization(self):
		# [summary]素因数分解した結果を、インスタンス変数に格納
		
		# 2,3,5で、割れなくなるまで割り続ける
		# (末尾に2,3,5のつく数は素数でないことが明白なので
		# 後続の処理で素数のリストに入れないように、先に処理する)
		self.__divide_with(2)
		self.__divide_with(3)
		self.__divide_with(5)
			
		# 平方根以下の素数で総当たりで試し割りする
		# (実際は、素数らしき数)
		import math
		sqrt_ = math.floor(math.sqrt(self.__n))
			
		primes = [7, 11, 13, 17, 19, 23, 29, 31]
		i = 0
		is_break = False
			
		while self.__n > 1:
			for p in primes:
				if p + i <= sqrt_:
					self.__divide_with(p + i)
				else:
					# 試し割りする数が平方根を超えたら、ループを抜ける
					is_break = True
						
					# 1が素因数に追加されることを防止
					if self.__n > 1:
						self.__factors.setdefault(self.__n, 1)
				
			if is_break:
				break
			else:
				i += 30
	
	
	def __divide_with(self, d):
		count = 0
		
		while self.__n % d == 0:
			self.__n //= d
			count += 1
		
		if count > 0:
			self.__factors.setdefault(d, count)


# C - Factors of Factorial
n = int(input())

if n == 1:
	print(1)
else:
	lib = Factorization()
	factors = dict()

	for i in range(2, n + 1):
		for k, v in lib.get_factors(i).items():
			factors.setdefault(k, 0)
			factors[k] += v
	
	ans = 1
	
	for v in factors.values():
		ans = ans * (v + 1) % (10 ** 9 + 7)

	print(ans)

Submission status: Accepted

Solution code:
import collections
import math

N = int(input())
N = math.factorial(N)
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

res = collections.Counter(prime_factorize(N))
keys = list(res.keys())
length = len(keys)
ans = 1
for i in range(length):
    ans = (ans * (res[keys[i]] + 1)) % INF
print(ans)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())

N = I()
mod = 10**9+7

import math

def sieve_of_eratosthenes(n):
    prime_list = []  # n以下の素数のリスト
    A = [1]*(n+1)    # A[i] = iが素数なら1,その他は0
    A[0] = A[1] = 0
    for i in range(2,math.floor(math.sqrt(n))+1):
        if A[i]:
            prime_list.append(i)
            for j in range(i**2,n+1,i):
                A[j] = 0
    for i in range(math.floor(math.sqrt(n))+1,n+1):
        if A[i] == 1:
            prime_list.append(i)
    return prime_list

prime_list = sieve_of_eratosthenes(N)

ans = 1
for p in prime_list:
    a = 0
    r = N
    while r >= p:
        a += r//p
        r //= p
    ans *= a+1
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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

prime_number_counter = Counter()

# factorial sequence.
for current_factorial_number in range(2, N + 1):
  # prime number calculation.
  cfn_holder = current_factorial_number
  for candidate_prime_number in range(2, current_factorial_number + 1):
    while cfn_holder % candidate_prime_number == 0:
      cfn_holder /= candidate_prime_number
      prime_number_counter[candidate_prime_number] += 1

ans = 1
for prime_number_count in prime_number_counter.values():
  ans *= prime_number_count + 1

print(ans % THE_NUMBER)

Submission status: Accepted

Solution code:
from collections import Counter


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())
count = Counter([])
for i in range(1, N + 1):
    res = prime_factorize(i)
    res = Counter(res)
    count += res

result = 1
for c in count.values():
    result = result * (c+1)
    result = result % 1000000007


print(result)