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:
# coding: utf-8
def prime_factorization(N):
    # 辞書型で素因数分解を返す
    pf = {}
    for i in range(2, int(N**0.5) + 1):
        while N % i == 0:
            if i not in pf.keys():
                pf[i] = 1
            else:
                pf[i] += 1
            N //= i
    if N > 1:
        pf[N] = 1
    return pf
mod = 10**9 + 7
N = int(input())
primes = {}
for v in range(1, N+1):
    p = prime_factorization(v)
    for k in p.keys():
        if k not in primes.keys():
            primes[k] = p[k]
        else:
            primes[k] += p[k]
ans = 1
for k in primes.keys():
    ans *= primes[k] + 1
    ans %= mod
print(ans % mod)

Submission status: Accepted

Solution code:
#import sympy

def count_divisor(num: int) -> int:
    i =1 
    count = 0
    while i * i < num:
        if num % i == 0:
            count += 2
        i += 1
    if num % i == 0:
        count += 1
    return count

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

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

data = [0] * (N+1)
i = N
while i > 0:
    #dic = sympy.factorint(i)
    lis = factorization(i)
    #for k, v in dic.items():
    #    data[k] += v
    for li in lis:
        k, v = li
        data[k] += v 
    i -= 1

ans = 1
data[1] = 0
for d in data:
    if d != 0:
        ans = ans * (d+1) % M
        ans %= M

print(ans)
#print(factorization(1))
#print(sympy.factorint(1))

Submission status: Accepted

Solution code:
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))

D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''



N = int(input())

g_sosuu = [] # bool



def eratos(n):
    global g_sosuu

    for i in range(n):
        g_sosuu.append(True)
        
    g_sosuu[0] = False
    g_sosuu[1] = False
    for i in range(2, int(math.sqrt(n)) + 1):
        if g_sosuu[i]:
            for j in range(i*2, n, i):
                g_sosuu[j] = False


eratos(N+10)

sosuu_list = []
for i in range(N+10):
    if g_sosuu[i]:
        sosuu_list.append(i)


ans = 1
count = [0]*1010
for n in range(1, N+1):
    
    for s in sosuu_list:

        for i in range(1, 100):
            if n%(s**i) == 0:
                count[s] += 1
            else:
                break

for c in count[2:]:
    ans *= (c+1)%MOD
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

factors = [0 for i in range(n+1)]

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

ans = 1

for f in factors:
    if f > 0:
        ans *= f+1
        ans %= 10**9+7

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
from math import *
input = sys.stdin.readline

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def factorization(n):
    # 参考: https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
    dic = defaultdict(int)
    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
            dic[i] = cnt
            
    if temp!=1:
        dic[temp] = 1
    if not dic:
        dic[n] = 1

    return dic

def main():
    mod = 10**9 +7
    n = int(input())
    facn = factorial(n)

    pf = defaultdict(int)
    for i in range(1, n+1):
        pfp = factorization(i)
        for j in pfp:
            pf[j] += pfp[j]

    ans = 1
    for i in pf:
        if i == 1:
            continue
        ans *= pf[i] + 1 
        ans %= mod
        
    print(ans)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
count = Counter()
for i in range(2, N+1):
    while i != 1:
        for j in range(2, N+1):
            if i % j == 0:
                i //= j
                count[j] += 1
                break
ans = 1
for x in count.values():
    ans *= (x+1)
    ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(n-1):
    n *= i+1
y = 1
while n % 2 == 0:
    y += 1
    n //= 2
f = 3
x = 1
while n > 1:
    if n % f == 0:
        x += 1
        n //= f
    else:
        f += 2
        y *= x
        x = 1
else: y *= x
print(y%1000000007)

Submission status: Accepted

Solution code:
from collections import defaultdict
mod=10**9+7
n=int(input())
sosu_list=[2]
for i in range(3,1002, 2):
    flag=0
    for j in range(2,int(i**.5)+1):
        if i%j==0:
            flag+=1
            break
    if flag==0:
        sosu_list.append(i)
shukei=defaultdict(int)
for i in range(1,n+1):
    soinsu=defaultdict(int)
    for sosu in sosu_list:
        t=i
        while t>0:
            if t%sosu==0:
                soinsu[sosu]+=1
                t//=sosu
            else:
                break
    for a,b in soinsu.items():
        shukei[a]+=b
ans=1
for a in shukei.values():
    ans*=(a+1)
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
NM = 1000
fs = [list() for _ in range(NM+1)]

from collections import Counter
C = Counter()
for i in range(2, N+1):
  if len(fs[i]) == 0:
    for j in range(i, N+1, i):
      d = j
      while j % i == 0:
        fs[j].append(i)
        j //= i
        C[i] += 1

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

count = [0] * (N+1)
def prime_fac(n,c):
    while n % 2 == 0:
        n //= 2
        c[2] += 1
    i = 3
    while n != 1:
        if n % i == 0:
            c[i] += 1
            n //= i
        else:
            i += 2
    return 0
        
for i in range(1,N+1):
    prime_fac(i,count)

ans = 1
for i in count[1:]:
    if i >= 1:
       ans *= (i+1) % mod
       ans %= mod

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

p = [0]*(N+1)

def pf(n):
    x = 2
    done = False
    while done == False:
        if n == 1:
            done = True
        if n % x == 0:
            n = n // x
            p[x] += 1
        else:
            x += 1
    
for i in range(1,N+1):
    pf(i)

ans = 1
for i in p:
    ans *= i+1
    ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter


def prime_factorize(n):
    p = 2
    fct = []
    # 素数pはp**2がnを超えないもの（ただしnはある素数で割り切れるだけ割り切れたもの）
    # これはある素数p(i)でnを割れる時、他の素数p(i以外)はn//p(i) を割り切れるものになるため

    # 例えば、nが54なら
    # p が2のとき 54 // 2 で27
    # 27はもう2で割り切れないので2は1個
    # この時点でnは27に更新されている
    # 次にp が3の時、何度もpで割る（3度）
    while n >= p ** 2:
        while n % p == 0:
            n //= p
            fct.append(p)
        p += 1
    if n > 1:
        fct.append(n)
    return fct


N = int(input())
MOD = 1000000007
numbers = []
for i in range(1, N+1):
    numbers += prime_factorize(i)

count_numbers = Counter(numbers)
ans = 1
for n in count_numbers.values():
    ans *= ((n+1) % MOD)

print(ans % MOD)

Submission status: Accepted

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

"""約数の個数"""
#参考：青チャp280
#注意：1も約数としてカウントされる
def factrize(n):
    b = 2
    fct = []
    for i in range(n+1):
        while b*b <= i:
            while i % b == 0:
                i //= b
                fct.append(b)
            b = b+1
        if i > 1:
            fct.append(i)
        b = 2
    
    divisor = dict()
    for i in fct:
        if not i in divisor:
            divisor[i] = 1
        else:
            divisor[i] += 1
    ans = 1
    for i in divisor.values():
        ans *= (i+1)
    return ans

print(factrize(n)%mod)

Submission status: Accepted

Solution code:
from collections import deque, defaultdict
from functools import reduce
from operator import mul

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

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break

if N == 1:
    ans = 1
else:
    ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

def fact(n):
    arr = defaultdict(int)
    temp = n
    for i in range(2,Math.roundUp(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
MOD = int(1e09) + 7

def main():
    N = cin.int()
    S = defaultdict(int)
    for i  in range(1,N + 1):
        T = fact(i)
        for k,v in T.items():
            S[k] += v
    ans = 1
    for v in S.values():
        ans *= (v+1)
        ans %= MOD
    print(ans)
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
from collections import Counter, defaultdict


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())
MOD = 10**9 + 7

if N == 1:
  print(1)
  sys.exit()
  
d = defaultdict(int)

for n in range(2, N+1):
  prime_factor = prime_factorize(n)
  for key, value in Counter(prime_factor).items():
    d[key] += value
    
ret = 1
for i in d.values():
  ret *= i + 1
  ret %= MOD
  
print(ret)

Submission status: Accepted

Solution code:
from collections import Counter
def prime_factorization(n):
    factor = []
    if n == 1:
        factor.append(1)
    for i in range(2,int(n**0.5)+1):
        while n%i == 0:
            n //= i
            factor.append(i)
    if n != 1:
        factor.append(n)
    return factor

n = int(input())
mod = 10**9+7
ans = 1
c = Counter()

for i in range(2,n+1):
    c.update(Counter(prime_factorization(i)))

for key in c:
    ans *= c[key] + 1
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

L = [0] * (N)

def prime_factorize(n):
  i = 2
  p_nums = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      p_nums.append(i)
    i += 1
  if n > 1:
    p_nums.append(n)
  return p_nums

for i in range(1,N + 1):
  P = prime_factorize(i)
  for j in range(len(P)):
    p = int(P[j])
    L[p - 1] += 1
    
total = 1
    
for i in L:
  if i != 0:
    total *= (i + 1)
    
div = 10 ** 9 + 7
  
print(total % div)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
mod=10**9+7
d=dict()
for i in range(1,n):
  cnt=0
  k=i+1
  for j in range(1,k):
    if k<j+1:
      break
    while k%(j+1)==0:
      k//=j+1
      cnt+=1
    if j+1 not in d:
      d[j+1]=cnt
    else:
      d[j+1]+=cnt
    cnt=0
d=list(d.items())
if len(d)==0:
  print(1)
else:
  ans=1
  for i in range(len(d)):
    ans*=(d[i][1]+1)%mod
  print(ans%mod)

Submission status: Accepted

Solution code:
N = int(input())
#N,M = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for i in range(N)]
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]]
ans = 1
mod = 10**9+7
prime = primes(N)
for i in prime:
    isum = 0
    for n in range(2,N+1):
        while n%i == 0:
            isum += 1
            n //= i
    ans = (ans*(isum+1))%mod
print(ans)

Submission status: Accepted

Solution code:
MOD = 1000000007
N = int(input())
d = dict()

for i in range(2, N+1):
    tmp = i
    div = 2
    while tmp > 1:
        if tmp % div == 0:
            if div not in d:
                d[div] = 1
            else:
                d[div] = d[div] + 1
            tmp = tmp // div
        else:
            div += 1
ans = 1
for div in d:
    ans = ans * (d[div] + 1) % MOD

print(ans)

Submission status: Accepted

Solution code:
import math
mod = 10 ** 9 + 7

def f(num):
    i = 2
    d = dict()
    while i ** 2 <= num:
        if num % i == 0:
            num //= i
            d[i] = d.get(i, 0) + 1
        else:
            i += 1
    d[num] = 1
    return d

n = int(input())

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

ans = 1
for i in f(math.factorial(n)).values():
    ans *= i+1

print(ans%mod)

Submission status: Accepted

Solution code:
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/abc107/tasks/arc101_a
# C - Candles
"""
need to consider the case that ticket is not enough to lower everything
"""

N = gi()
cnt = [0] * (N + 1)

cnt[1] = 1

for i in range(2, N + 1):
    t = i
    for d in range(2, int(sqrt(i)) + 1):
        while (t % d == 0):
            cnt[d] += 1
            t = t // d

    if (t > 1):
        cnt[t] += 1

ans = 1

#print(cnt)

for d in range(2, N + 1):
    if cnt[d]:
        ans *= (cnt[d] + 1)
        ans %= MOD

print(ans)

Submission status: Accepted

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

primes=[]
is_prime = [True]*(N+1)
is_prime[0]=is_prime[1]=False
i=2
for i in range(N+1):
    if is_prime[i]:
        primes.append(i)
        j=i*2
        while j <= N:
            is_prime[j]=False
            j+=i

factor_num=dict()
for p in primes:
    factor_num[p]=0
for n in range(2,N+1):
    for p in primes:
        m=n
        while m:
            if m%p:
                break
            factor_num[p]+=1
            m//=p

ans=1
for f in factor_num.values():
    ans=ans*(f+1)%MOD

print(ans)

Submission status: Accepted

Solution code:
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
            # arr.append([i, cnt])

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

    if arr == []:
        arr[n] = 1

    return arr

ans = {}
for i in range(1, N+1):
    arr = factorization(i)
    for key, value in arr.items():
        if key in ans:
            ans[key] += value
        else:
            ans[key] = value

count = 1
for v in ans.values():
    count *= v+1

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

Submission status: Accepted

Solution code:
isP = [True for _ in range(1005)]
isP[0] = isP[1] = False
for i in range(2, 1005):
  for j in range(2, 1005):
    if i * j >= 1005:
      break
    isP[i*j] = False
P = []
for i in range(1005):
  if isP[i]:
    P.append(i)
N = int(input())
ans = 1
for p in P:
  if p > N:
    continue
  else:
    k = p
    t = 1
    while k <= N:
      t += N // k
      k *= p
    ans *= t
print(ans % 1000000007)

Submission status: Accepted

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))
# import sys
# input = 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 arr==[]:
        arr.append([n, 1])

    return arr

N=one_int()

dicts={}
for i in range(2,N+1):
    lists = factorization(i)
    for item in lists:
        if item[0] != 1:
            if item[0] in dicts:
                dicts[item[0]] += item[1]
            else:
                dicts[item[0]] = item[1]

div=10**9 + 7
ans=1

for k,v in dicts.items():
    ans *= (v+1)%div

print(ans%div)

Submission status: Accepted

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

# 本文
N = int(input())

ans_dict = {}
for i in range(2, N + 1):
    buf = primeFactorize(i)

    for j in buf:
        if not j in ans_dict:
            ans_dict[j] = 1
        else:
            ans_dict[j] += 1

ans = 1
for i in ans_dict.values():
    ans *= (i + 1)

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

Submission status: Accepted

Solution code:
N = int(input())

pn=[2];A=1000
for L in range(3,A):
  chk=True
  for L2 in pn:
    if L%L2 == 0:chk=False
  if chk==True:pn.append(L)

mul = [1 for i in range(1001)]
for i in range(1,N+1):
  for j in pn:
    if j > i:
      break
    temp = i
    while True:
      if temp%j == 0:
        temp /= j
        mul[j] += 1
        continue
      else:
        break

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

Submission status: Accepted

Solution code:
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])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
d = {}
for i in range(2, n+1):
  a = factorization(i)
  for i in a:
    if i[0] not in d.keys():
      d[i[0]] = i[1]
    else:
      d[i[0]] += i[1]
ans = 1
for value in d.values():
  ans *= value+1
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30


def hurui(n):
    is_prime = [0] * (10**5)
    for i in range(2, n+1):
        is_prime[i] = 1
    for i in range(2, n+1):
        if is_prime[i] == 1:
            j = i*2
            while j <= n:
                is_prime[j] = 0
                j += i
    return is_prime

def main():
    n = int(input().strip())
    is_prime = hurui(n)
    ans = 1
    for i in range(2, n+1):
        if is_prime[i] == 1:
            c = 0
            for j in range(i, n+1):
                p = j
                while p % i == 0:
                    p //= i
                    c += 1
            ans *= (c+1)
            ans %= (10**9+7)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9+7

dic = {}
L = [1]*(N+1)
L[0] = 0
L[1] = 0
for i in range(2, N+1):
    j = 2
    while i*j < N+1:
        L[i*j] = 0
        j += 1
        
for i in range(N+1):
    if L[i] == 1:
        dic[i] = 0

if N > 1:
    for i in range(2, N+1):
        j = 2
        while i > 1:
            if L[j] == 1 and i%j == 0:
                dic[j] += 1
                i //= j
            else:
                j += 1
            
    ans = 1
    for i in dic:
        if dic[i] > 0:
            ans *= (dic[i]+1)
            ans %= mod
else:
    ans = 1
        
print(ans)

Submission status: Accepted

Solution code:
#n<=10**3

n = int(input())

fct = [1]*(n+1)
fct[1] = 0
fct[0] = 0
mod = 10**9+7
#print(mod)
sq = int(n**(1/2))+5###1//2はゼロだwww
#print(sq)
for i in range(2,sq):
    for j in range(2,(n//i)+10):
        if i*j<=n:
            fct[i*j] = 0
            #if i==7 or j ==11:
            #    print("test",i,j)

#print(fct)
prm = []

for i in range(n+1):
    if fct[i]:
        prm.append(i)
#print("prm",prm)
ind = []

for p in prm:
    tmp = 0
    tmp2 = n
    while tmp2:
        tmp2//=p 
        tmp += tmp2 
    ind.append(tmp)
ans = 1
for i in ind:
    ans *= (i+1)
    ans %= mod

#print("ind",ind)
print(ans)

Submission status: Accepted

Solution code:
import bisect
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

n = int(input())
prime = prime(10**3)
l = [0] * len(prime)
for i in range(1,n+1):
  for j in range(len(prime)):
    while i % prime[j] == 0:
      i = i // prime[j]
      l[j] += 1
a = 1
for i in l:
  a = (a * (i+1)) % (10**9+7)
print(a)

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
r = 10 ** 9 + 7
d = defaultdict(int)
for n in range(1, N+1):
    temp = n
    i = 2
    while i ** 2 <= temp:
        while temp % i == 0:
            d[i] += 1
            temp //= i
        i += 1
        if temp < i:
            break
    if temp != 1:
        d[temp] += 1
ans = 1
if d != {}:
    for v in d.values():
        ans = (ans * (v + 1)) % r
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

MOD = 10**9+7

NN = [0 for _ in range(1001)]
AA = [0 for _ in range(1001)]


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        # if NN[temp] != 0:
        #     arr.append(NN[temp][0])
        #     return arr
        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

ans = 1
for i in range(1, N+1):
    chin = factorization(i)
    # NN[i] = chin
    # print(chin)
    for x,y in chin:
        AA[x] += y
for i in range(2, N+1):
    if AA[i] > 0:
        # print(i, AA[i])
        ans *= (AA[i]+1) % MOD
        ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

    return arr

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

arr = [0 for _ in range(1001)]

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

    for j in range(len(fact(i))):
        arr[fact(i)[j][0]] += fact(i)[j][1]

ans = 1
for i in range(2,1001):
    if arr[i] > 0:
        ans *= arr[i] +1
    if ans > 1000000007:
        ans % 1000000007

print(ans % 1000000007)

Submission status: Accepted

Solution code:
import sys
N=int(input())
if N == 1:
    print(1)
    sys.exit()
lim=10**9+7
import numpy as np
def seachPrimeNum(N):
    max_ = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max_:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

ans = 1
l=seachPrimeNum(N)
#print(l)
for p in l:
    temp=0
    k=1
    while True:
        if p**k>N:
            break
        temp += N//(p**k)
        k+=1
    ans = (ans * (temp + 1)) % lim
    #print(N//p + 1)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

result = [0 for i in range(n+1)]

for i in range(1, n+1):
    for j in range(2, i+1):
        while i%j == 0:
            result[j] += 1
            i //= j
        if i == 1:
            break
r = 1
for i in range(n+1):
    r *= result[i]+1
    r %= 10**9 + 7
print(r)

Submission status: Accepted

Solution code:
n=int(input())
cnt=[]
def prime(x):
    for i in range(2,x+1):
        while x%i==0:
            x/=i
            cnt.append(i)   
           
if n==1:
    print(1)
else:
    li=[]
    for j in range(2,n+1):
        prime(j)
    cnt.sort() 
    
    ans=[1]*len(set(cnt))
    x=-1
    for k in cnt:
      if k in li:
        ans[x]+=1
      else:
        li.append(k)
        x+=1
        ans[x]+=1
    y=1
    for l in ans:
      y*=l
        
    print(y%(10**9+7))

Submission status: Accepted

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

def prime_factorization(n):
    '''
    素因数分解を求める

    Parameters:
    n : int
        求める数
    
    Returns:
    r : list
        素因数分解の結果
    '''
    r=[1]*(n+1)
    for i in range(1,n+1):
        for j in range(2,i+1):
            while i % j == 0:
                r[j] += 1
                i //= j
    
    return r

r = prime_factorization(N)
ans = 1
for i in r:
    ans *= i
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
"素因数分解のライブラリ"
from collections import Counter


def prime_factorize(n):
    b = 2
    fct = []
    while n >= b ** 2:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


N = int(input())
MOD = 1000000007
numbers = []
for i in range(1, N+1):
    numbers.extend(prime_factorize(i))

count_numbers = Counter(numbers)
ans = 1
for n in count_numbers.values():
    ans *= ((n+1) % MOD)

print(ans % MOD)

Submission status: Accepted

Solution code:
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=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())
cnt={}
for i in range(1,n+1):
    for j in prime_factorize(i):
        if j not in cnt:cnt[j]=1
        else:cnt[j] +=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

result = [0 for i in range(n+1)]

for i in range(1, n+1):
    for j in range(2, i+1):
        while i%j == 0:
            result[j] += 1
            i //= j
        if i == 1:
            break
r = 1
for i in range(n+1):
    r *= result[i]+1
    r %= 10**9 + 7
print(r)

Submission status: Accepted

Solution code:
import math
from collections import Counter
from collections import defaultdict

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

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

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

    return arr

N = int(input())
MOD = 10 ** 9 + 7
d = defaultdict(int)
for i in range(2, N+1):
    ar = factorization(i)
    for k, v in ar:
        d[k] += v
answer = 1
for k, v in d.items():
    answer *= (v+1)
    answer %= MOD
print(answer)