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:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class Sieve:
    def __init__(self, n):
        self.plist = [2]  # n以下の素数のリスト
        min_prime_factor = [2, 0] * (n // 2 + 5)
        for x in range(3, n + 1, 2):
            if min_prime_factor[x] == 0:
                min_prime_factor[x] = x
                self.plist.append(x)
                if x ** 2 > n: continue
                for y in range(x ** 2, n + 5, 2 * x):
                    if min_prime_factor[y] == 0:
                        min_prime_factor[y] = x
        self.min_prime_factor = min_prime_factor

    def isprime(self, x):
        return self.min_prime_factor[x] == x

    # これが素因数分解(prime factorization)
    def pfct(self, x):
        pp, ee = [], []
        while x > 1:
            mpf = self.min_prime_factor[x]
            if pp and mpf == pp[-1]:
                ee[-1] += 1
            else:
                pp.append(mpf)
                ee.append(1)
            x //= mpf
        return [(p, e) for p, e in zip(pp, ee)]

def main():
    md=10**9+7
    sv=Sieve(1005)
    cnt_e=[0]*1005
    for a in range(2,II()+1):
        pe=sv.pfct(a)
        for p,e in pe:cnt_e[p]+=e
    ans=1
    for e in cnt_e:ans=ans*(e+1)%md
    print(ans)

main()

Submission status: Accepted

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


n = int(input())

prime = []
for i in range(2, n+1):
    prime = prime + prime_factor(i)

from collections import Counter

primec = Counter(prime)

ans = 1

primec_list = primec.most_common()

mod = 10**9+7

for p in primec_list:
    ans = ans * (p[1]+1) % mod

print(ans)

Submission status: Accepted

Solution code:
import math

def is_prime(n):
  if n & 0: return False
  for i in range(2, int(math.sqrt(n))+1):
    if n % i == 0:
      return False
  return True
  
def prime(n):
  if n < 2: return []
  P = [2]
  for i in range(3, n+1):
    if is_prime(i):
      P.append(i)
  return P

n = int(input())
P = prime(n)
cnt = [0]*len(P)

for i in range(2, n+1):
  x = i
  pi = 0
  while x > 1 and pi < len(P):
    if x % P[pi] == 0:
      cnt[pi] += 1
      x //= P[pi]
    else:
      pi += 1

ans = 1
for c in cnt:
  ans *= c+1
  ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

#素因数分解
def prime_factorize(N):
    f = []
    while N % 2 == 0:
        f.append(2)
        N //= 2
    i = 3
    while i * i <= N:
        while N % i == 0:
            f.append(i)
            N //= i
        i += 2
    #最後残った数について
    if N != 1:
        f.append(N)
    return f

#main
N = int(input())
MOD = 10**9 + 7
exp = [0] * (N+1)

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import Counter

# nを素因数分解
# 各素因数を数え上げる場合は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())
    
d = defaultdict(lambda: 0)

if N == 1:
    print(1)
else:
    for i in range(2, N+1):
        a = prime_factorize(i)
        c = Counter(a)
        for k, v in c.items():
            d[k] += v

    count = 1
    for v in d.values():
        count *= (v + 1)
        count %= int(1e9+7)
    print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

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

    for i in range(len(arr)):
        d[arr[i][0]]+=arr[i][1]
    return

ans=1
for i in range(1,n+1):
    factorization(i)

for i,m in d.items():
    if i!=1:
        ans*=(m+1)
        ans%=mod
print(ans)

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    
    #nの素因数分解，[[a1,b1],[a2,b2]...]   aがb個,
    def factorization(n):
        if n==1:
            return [0,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
                arr.append([i, cnt])

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

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

        return arr
    
    N=I()
    ans=1
    L=[0]*(N+1)
    for i in range(2,N+1):
        arr=factorization(i)
        for j in range(len(arr)):
            L[arr[j][0]]+=arr[j][1]
    
    for i in range(len(L)):
        ans*=(L[i]+1)
        ans%=mod
    print(ans)
    

main()

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    M = 10 ** 9 + 7
    pl = [0] * (n + 1)

    for i in range(2, n+1):
        x = i
        p = 2
        while x > 1:
            while x % p == 0:
                pl[p] += 1
                x //= p
            p += 1
    ans = 1
    for s in pl:
        ans *= (s+1)

    print(ans % M)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
mo = 1000000007
r = range
    
n = int(input())
    
primes = set()
for i in r(2, 1000):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)
    
d = {}
for i in r(2, n+1):
    x = i
    while x != 1:
        for p in primes:
            if x % p != 0:
                continue
            x //= p
            if p not in d:
                d[p] = 0
            d[p] += 1
            break
    
ret = 1
for i in d.values():
    ret *= (i+1)
    ret %= mo
    
print(ret)

Submission status: Accepted

Solution code:
MAX_PRIME = 10**5
is_prime = [1] * MAX_PRIME
primes = []
is_prime[0] = 0
is_prime[1] = 0
for i in range(MAX_PRIME):
    if is_prime[i]:
        primes.append(i)
        for j in range(2, ((MAX_PRIME-1)//i) + 1):
            is_prime[i*j] = 0

m = int(input())
mod = 10 ** 9 + 7
factor = [0] * (m+1)
for n in range(1, m+1):
    for p in primes:
        if p ** 2 > n:
            break
        while n % p == 0:
            n //= p
            factor[p] += 1
    if n > 1:
        factor[n] += 1

ans = 1
for x in factor:
    if x:
        ans *= x+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

n = int(input())
if n == 1:
    print(1)
    exit()
cnt = [0] * (n+1)
for i in range(1, n+1):
    val = 1
    arr = factorization(i)
    for j in arr:
        cnt[j[0]] += j[1]
ans = 1
for i in range(2, n+1):
    ans *= cnt[i] + 1
    if ans >= 10**9+7:
        ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt,ceil
n = int(input())
d = [0] * (n+1)
INF = int(1e9)+7
def prime_factor(x):
    for i in range(2,ceil(sqrt(n))+1):
        while x % i == 0:
            d[i] += 1
            x //= i
    if x != 1:
        d[x] += 1
    return
for i in range(1, n+1):
    prime_factor(i)
ans = 1
for i in range(n+1):
    if d[i] != 0:
        ans *= d[i] + 1
        ans %= INF
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
array=[]
for i in range(2,n+1):
    s=i
    while s!=1:
        turn=0
        for j in range(2,s+1):
            if s%j==0:
                s=s//j
                array.append(j)
                break
ans=1
import collections
c=collections.Counter(array)
l=list(c.values())
for i in range(len(l)):
    ans*=l[i]+1
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
def the_sieve_of_eratosthenes(i):
    s = [j for j in range(2, i + 1)]
    j = 0
    while True:
        if j >= i - 3:
            for k in range(len(s) - 1, 0, -1):
                if s[k] == 0:
                    del s[k]
            return s
        if s[j] != 0:
            for k in range(2 * s[j] - 2, i - 1, s[j]):
                s[k] = 0
        j += 1

n = int(input())
p = the_sieve_of_eratosthenes(10 ** 3 + 9)
c = [0] * len(p)
j = 0
for i in range(2, n + 1):
    if i == p[j]:
        c[j] += 1
        j += 1
    else:
        k = 0
        m = i
        while True:
            if m == 1:
                break
            if m % p[k] == 0:
                c[k] += 1
                m /= p[k]
            else:
                k += 1
ans = 1
for i in c:
    ans *= i + 1
    if ans >= 10 ** 9 + 7:
        ans %= 10 ** 9 + 7
print(ans)

Submission status: Accepted

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


def fact(n, d):
    div = 2
    while n > 1 and div * div <= n:
        if n % div == 0:
            n //= div
            d[div] += 1
        else:
            div += 1
    if n > 1:
        d[n] += 1


for i in range(2, n+1):
    fact(i, f)
ans = 1
mod = 10**9 + 7
for k,v in f.items():
  ans = (ans * (v+1)) % 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

n=int(input())

x=[0]*1000
for i in range(2,n+1):
  p=prime_factorize(i)
  for _ in p:
    x[_]+=1

ans=1
for _ in x:
  if _ > 0:
    ans=(ans*(_+1))%(10**9+7)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

prime = []
for i in range(2, 1000) :
    flag = True
    for p in prime :
        if i%p == 0 :
            flag = False
    if flag == True :
        prime.append(i)

pcount = [0 for _ in range(len(prime))]

def bek(n, p) :
    temp = 0
    while n%p == 0 :
        temp += 1
        n //= p
    return temp

for i in range(len(prime)) :
    for j in range(1,N+1) :
        pcount[i] += bek(j, prime[i])

ans = 1
for i in range(len(prime)) :
    ans = (ans * (pcount[i]+1))%mod

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

def main():
  n = int(input())
  mod = 10**9 + 7
  primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
  fact = defaultdict(int)
  for i in range(2, n + 1):
    tmp = i
    for j in primes:
      if tmp % j == 0:
        cnt = 0
        while tmp % j == 0:
          cnt += 1
          tmp //= j
        fact[j] += cnt
    if tmp != 1:
      fact[tmp] += 1
    if not fact:
      fact[i] = 1
  ans = 1
  for f in fact.values():
    ans = ans * (f + 1) % mod
  print(ans)
 
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
N=int(input())
b=1
for a in range(1,N+1):
    b*=a
numbers=[2]
for c in range(3,N+1):
    count=0
    for d in numbers:
        if not c%d==0:
            count+=1
        else:
            pass
    if count==len(numbers):
        numbers.append(c)
    else:
        pass
answers=[]
while b>1:
    for e in numbers:
        kazu=0
        while b%e==0:
            b=b//e
            kazu+=1
        answers.append(kazu)
kotae=1
for f in answers:
    kotae*=(f+1)
print(kotae%(10**9+7))

Submission status: Accepted

Solution code:
import math
mod = 10 ** 9 + 7
n = int(input())
list = [0] * (n + 1)

#素因数分解
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

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2]!=1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0], w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m

for x in range(n - 1):
    facList = factorization(x + 2)
    for fac in facList:
        list[fac[0]] += fac[1]
ans = 1
for x in list:
    ans *= x + 1
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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


def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def factorial(n):
    res = 1
    for i in range(1, N+1):
        res *= i
    return res

N = INT()
f = factorial(N)
divisor = 1
A = [0] * (N + 1)

prime_list = primes_for(N)
tmp = f
for p in prime_list:
    cnt = 0
    if tmp % p == 0:
        while tmp % p == 0: 
            tmp = tmp // p
            A[p] += 1

for a in A:
    divisor *= (a + 1)
print(divisor % mod)

Submission status: Accepted

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

n = int(input())

array = [0] * 1000

for i in range(2, n+1):
  tmp = i
  j = 2
  while j <= math.ceil(math.sqrt(tmp)):
    if tmp % j == 0:
      while tmp % j ==0:
        array[j] += 1
        tmp //= j
    
    j += 1
      
  if tmp != 1:
    array[tmp] += 1
  
ans = 1
for v in array:
  ans = ((v+1)*ans) % MOD
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10 ** 9 + 7
prime = [1] * 1001  # 素因数の個数の初期値を1に設定する
for num in range(2, n + 1):
    while num % 2 == 0:  # 偶数のとき
        prime[2] += 1  # 2で割れる回数を記録
        num //= 2  # 2で割っておく
    odd = 3
    while odd ** 2 <= num:  # 奇数の素因数を考える
        while num % odd == 0:  # ある奇数で割れた時
            prime[odd] += 1  # 奇数の素因数の個数を記録する
            num //= odd  # 奇数で割っておく
        odd += 2 # 次の奇数にする
    if num != 1:  # numが1でない時はそれ自身で割れるので1追加する
        prime[num] += 1
ans = 1  # ansの初期値を定義する
for i in range(1001):
    ans *= prime[i]  # 約数の個数を計算する
print(ans % mod)  # modで割った余りを出力する

Submission status: Accepted

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

    def Eratosthenes(sup: int) -> set:
        from math import sqrt
        primes = {i for i in range(2, sup+1)}
        for i in range(2, int(sqrt(sup+1))+1):
            if i in primes:
                mul = 2
                while i*mul <= sup:
                    primes.discard(i*mul)
                    mul += 1
        return primes

    ps = Eratosthenes(N)
    ans = 1
    for p in ps:
        cur = 0
        i = 1
        while N//(p**i) > 0:
            cur += N//(p**i)
            i += 1
        ans *= (cur+1)
        ans %= MOD
    print(ans % MOD)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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


M = defaultdict(int)

for n in range(1, N+1):
    P = prime_factorize(n)
    for p in P:
        M[p] += 1

MOD = 10 ** 9 + 7
ans = 1
for k, v in M.items():
    ans *= v+1
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc052/tasks/arc067_a
# N!の約数の個数
# N, N-1, N-2 について素因数分解を個々に行い、素因数とその個数をカウントしていく
# 各素因数の出現回数について (a1+1)(a2+1)...が答え。


def factorization(n: int):
    if n == 1:
        return []  # 1は素数ではない
    # 素因数分解
    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


MOD = 10**9 + 7
from collections import defaultdict
N = int(input())
factor_num = defaultdict(lambda: 0)
for n in range(1, N + 1):
    tmp = factorization(n)
    for k, v in tmp:
        factor_num[k] += v

# 約数の個数
ans = 1
for v in factor_num.values():
    ans *= (v + 1)
    if ans >= MOD:
        ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

num = int(input().rstrip())

md = 1000000000 + 7

cnt = {}


def prime_devide(n):
    current = n

    ret = {}
    div = 2
    while current > 1:
        if current % div == 0:
            ret[div] = 0
            while current % div == 0:
                ret[div] += 1
                current = int(current / div)
        div += 1
    return ret


if num == 1:
    print(1)

else:
    for i in range(2, num + 1):
        tmp = prime_devide(i)
        for k, v in tmp.items():
            if k in cnt:
                cnt[k] += v
            else:
                cnt[k] = v
    ans = 1
    for k, v in cnt.items():
        ans *= (v + 1)
        ans = ans % md
    ans = ans % md
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = {}
for i in range(N):
	b = i + 1
	j = 2
	while j * j <= b:
		while b % j == 0:
			if j in a:
				a[j] += 1
			else:
				a[j] = 1
			b /= j
		j += 1
	if b != 1:
		if b in a:
			a[b] += 1
		else:
			a[b] = 1
c = 1
for i in a.values():
	c *= i + 1
print(c % 1000000007)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import Counter
from functools import reduce
import sys


def fc(n: int):
    for p in range(2, n + 1):
        while 1:
            q, r = divmod(n, p)
            if r != 0:
                break
            yield p
            n = q
        if n == 1:
            break


MOD = 1000000007  # type: int


def solve(N: int):
    fs = Counter()
    for i in range(1, N + 1):
        fs.update(fc(i))
    print(reduce(lambda a, b: a * (b + 1) % MOD, fs.values(), 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
U = 10**3
T = np.zeros(U,np.int32)
T[2]=1
T[3::2]=1
for i in range(U):
  if i*i>U:
    break
  if T[i]==1:
    T[i*i::2*i] = 0
pls = np.where(T)[0]
N = int(input())
MOD = 10**9+7
dic = {}
for i in range(2,N+1):
  for p in pls:
    if p>i:
      break
    while i%p==0:
      dic[p] = dic.get(p,0)+1
      i //= p
ans = 1
for v in dic.values():
  ans *= (v+1)
  ans %= MOD
print(ans)

Submission status: Accepted

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

def sieve(n):
    prime=[]
    limit=n**0.5
    data=[i+1 for i in range(1,n)]
    while True:
        p=data[0]
        if limit<=p:
            return prime+data
        prime.append(p)
        data=[e for e in data if e%p!=0]
        
ans=1
prime=sieve(n+1)
for p in prime:
    cnt=0
    j=1
    while p**j<=n:
        cnt+=n//(p**j)
        cnt%=mod
        j+=1
    ans*=(cnt+1)
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from math import factorial


def main():
    number = factorial(int(input()))
    mod = 10 ** 9 + 7
    prime_factors = []
    while not number % 2:
        prime_factors.append(2)
        number //= 2
    i = 3
    while i <= number:
        if not number % i:
            number //= i
            prime_factors.append(i)
        else:
            i += 2
    answer = 1
    for p in list(Counter(prime_factors).values()):
        answer = answer * (p + 1) % mod
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9 + 7
li = [0] * (10**3 + 10)

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

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

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

    return arr

for i in range(1,n+1):
    li2 = factorization(i)
    for j in li2:
        li[j[0]] += j[1]

ans = 1

for i in li[2:]:
    if i != 0:
        ans *= (i+1)
        ans %= mod

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
li = [0] * 1001
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
if N ==1:
    print(1)
else:
    ans = 1
    for i in range(2,N+1):
        arr = factorization(i)
        n = len(arr)
        for j in range(n):
            x = arr[j][0]
            y = arr[j][1]
            li[x] += y
    for i in range(2,1000):
        k = li[i]+1
        ans = ans * k % mod
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(1)
    exit()
mod = 10**9+7
ans = {}
ans[2] = 0
for i in range(2,n+1):
    for j in ans.keys():
        while i % j == 0:
            ans[j] += 1
            i //= j
    if i != 1:
        ans[i] = 1
k = 1
for i in ans.values():
    k *= i+1
    k %= mod
print(k)

Submission status: Accepted

Solution code:
import math


def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor


n = int(input())
mod = 10**9 + 7
ans = {}
for i in range(2, n+1):
    for s in trial_division(i):
        if s == 1:
            continue
        if s in ans.keys():
            ans[s] += 1
        else:
            ans[s] = 1
w = 1
for i in ans.values():
    w *= (i+1)
    w %= mod
print(w)

Submission status: Accepted

Solution code:
NUM = 10**9 + 7
def solve():
    N = int(input())
    dict = {}
    for n in range(2, N + 1):
        for i in range(2, n + 1):
            while n % i == 0:
                n //= i
                if not i in dict.keys():
                    dict[i] = 1
                else:
                    dict[i] += 1
    res = 1
    for i in dict.values():
        res *= (i + 1)
        res %= NUM
    return res

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
from math import floor, sqrt
from collections import defaultdict
def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d
N = int(input())
mod = 10**9+7
d = defaultdict(int)
for i in range(1,N+1):
    e = factors(i)
    for k in e:
        d[k] += e[k]
ans = 1
for k in d:
    ans = (ans*(d[k]+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

from collections import defaultdict
d = defaultdict(int)

N = int(input())

li = []

for n in range(1, N+1):
  a = factorization(n)
  for i in a:
    d[i[0]] += i[1]

ans = 1

for i in d:
  if i == 1:
    continue
  
  ans = ans * (d[i] + 1)

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

Submission status: Accepted

Solution code:
N = int(input())
insu_list = [[2, 0]]
ans = 1

for i in range(N):
    n = i+1
    for j in range(len(insu_list)):
        while n % insu_list[j][0] == 0:
            n /=insu_list[j][0]
            insu_list[j][1] += 1
    if n != 1:
        insu_list.append([n, 1])
for i in range(len(insu_list)):
    ans *= insu_list[i][1] + 1
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
LARGE = 10 ** 9 + 7

def prime_factorize_dict(N):
    d = dict()
    for n in range(1, N + 1):
        while not n & 1:
            d[2] = d.get(2, 0) + 1
            n >>= 1
        f = 3
        while f * f <= n:
            if not n % f:
                d[f] = d.get(f, 0) + 1
                n //= f
            else:
                f += 2
        if n != 1:
            d[n] = d.get(n, 0) + 1
    return d

N = int(input())
total = 1
for p in prime_factorize_dict(N).values():
    total *= (p + 1)

print(total % LARGE)

Submission status: Accepted

Solution code:
import math

N = int(input())

class remainder():
    def __init__(self, mod=(10**9 + 7)):
        self.mod = mod
    
    def mul(self, a, b):
        return ((a % self.mod) * (b % self.mod)) % self.mod

    def pow(self, a, b):
        bp = []
        #bp.append(1)
        bp.append(a)

        n = len(bin(b)) - 2
        for x in range(n):
            bp.append(bp[x]**2 % self.mod)

        res = 1
        for x in range(n):
            if b >> x & 1:
                res = (res * bp[x]) % self.mod
        
        return res

    def div(self, a, b):
        
        return self.mul(a, self.pow(b, self.mod - 2))


def findAllOfPrime(N):
    prime = [True] * (N + 1)
    prime[0] = False
    prime[1] = False

    x = 2
    while x**2 <= N:
        if prime[x]:
            j = 2
            while x * j <= N:
                prime[x * j] = False
                j += 1
        x += 1

    return prime

re = remainder()
primes = set()
for n in range(1, N + 1):
    prime = findAllOfPrime(n)
    for i, p in enumerate(prime):
        if p:
            primes.add(i)

A = math.factorial(N)
ans = 1
for p in primes:
    cnt = 1
    while A % p == 0:
        cnt += 1
        A //= p
    ans = re.mul(ans, cnt)
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
primes = np.array([  2,   3,   5,   7,  11,  13,  17,  19,  23,  29,  31,  37,  41,
        43,  47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97, 101,
       103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
       173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,
       241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
       317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
       401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
       479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,
       571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
       647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
       739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,
       827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
       919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],dtype = np.int64)
n = int(input())
div = primes[primes <= n]
mod = 10**9 + 7
def divide(p,n):
    if n < p:
        return 0
    return divide(p,n//p) + n//p
ans = 1
for p in div:
    ans *= (divide(p,n) + 1) 
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
def prim(p):
  if p == 2:
    return True
  else:
    flg = False
    count = 0
    for i in range(1, int(p ** 0.5) + 1):
      if p % i == 0:
        count += 1
    if count == 1:
      flg = True
    return flg
N = int(input())
if N == 1:
  print(1)
else:
  p_list = []
  for j in range(2, N + 1):
    if prim(j):
      p_list.append(j)
  l = []
  for p in p_list:
    k = 1
    add = 0
    while N // (p ** k):
      add += N // (p ** k)
      k += 1
    l.append(add + 1)
  ans = 1
  for r in l:
    ans *= r
    ans = ans % (10 ** 9 + 7)
  print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    prime_num = [1]*1001
    for n in range(2,N+1,1):
        while n % 2 == 0:
            prime_num[2] += 1
            n //= 2
        
        f = 3
        while f * f <= n:
            while n % f == 0:
                prime_num[f] += 1
                n //= f
            f += 2
        if n != 1:
            prime_num[n] += 1
    ans = 1
    for i in range(1001):
        ans *=prime_num[i]
    print(ans % (10**9+7))
    

if __name__ == '__main__':
    main()