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

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

class ModInt:
    def __init__(self, n=0, mod=mod):
        self.mod = mod
        self.n = n % self.mod
    
    def value(self):
        self.n %= self.mod
        return self.n
    
    def __add__(self, rhs):
        if isinstance(rhs, ModInt):
            return self.__class__(self.n + rhs.n, self.mod)
        return self.__class__(self.n + rhs, self.mod)
    
    __radd__ = __add__
    
    def __sub__(self, rhs):
        if isinstance(rhs, ModInt):
            return self.__class__(self.n - rhs.n, self.mod)
        return self.__class__(self.n - rhs, self.mod)
    
    def __rsub__(self, lhs):
        if isinstance(lhs, ModInt):
            return self.__class__(lhs.n - self.n, self.mod)
        return self.__class__(lhs - self.n, self.mod)

    def __mul__(self, rhs):
        if isinstance(rhs, ModInt):
            return self.__class__(self.n * rhs.n, self.mod)
        return self.__class__(self.n * rhs, self.mod)
    
    __rmul__ = __mul__

    def __floordiv__(self, rhs):
        if isinstance(rhs, ModInt):
            return self.__class__(self.n // rhs.n, self.mod)
        return self.__class__(self.n // rhs, self.mod)
    
    def __rfloordiv__(self, lhs):
        if isinstance(lhs, ModInt):
            return self.__class__(lhs.n // self.n, self.mod)
        return self.__class__(lhs // self.n, self.mod)

    def __iadd__(self, rhs):
        if isinstance(rhs, ModInt):
            self.n += rhs.n
        else:
            self.n += rhs
        if self.n >= self.mod:
            self.n -= self.mod
        
        return self
    
    def __isub__(self, rhs):
        rhs_n = rhs.n if isinstance(rhs, ModInt) else rhs
        if self.n < rhs_n:
            self.n += self.mod
        self.n -= rhs_n
        return self
    
    def __imul__(self, rhs):
        rhs_n = rhs.n if isinstance(rhs, ModInt) else rhs
        self.n = self.n * rhs_n % self.mod
        return self
    
    def __ifloordiv__(self, rhs):
        rhs_n = rhs.n if isinstance(rhs, ModInt) else rhs
        exp = self.mod - 2
        while exp:
            if exp % 2:
                self *= rhs_n
            
            rhs_n *= rhs_n
            rhs_n %= self.mod
            exp //= 2
        
        return self
    
    def __pow__(self, exp):
        exp_n = exp.n if isinstance(exp, ModInt) else exp
        if exp_n == 0:
            return self.__class__(1, self.mod)
        if exp_n % 2 == 0:
            t = self.__pow__(exp_n // 2)
            return t * t
        return self * self.__pow__(exp_n - 1)
    
    def __str__(self):
        return str(self.value())

def is_prime(x):
    i = 2
    if x <= 1:
        return False
    while i * i <= x:
        if x % i == 0:
            return False
        i += 1
    return True


n = ni()

ans = ModInt(1)
for i in range(2, n + 1):
    if is_prime(i):
        j = i
        cnt = 0
        while j <= n:
            cnt += n // j
            j *= i
        cnt += 1
        ans *= cnt

print(ans)

Submission status: Accepted

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

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

primes = dict()
for a in range(2,N+1):
    c = prime_factorize(a)
    if len(c) == 1:
        i = 1
        cnt = 0
        while a**i<=N:
            cnt += (N//a**i)
            i += 1
        primes[a] = cnt
ans = 1
for i in primes.values():
    ans *= (i+1)
    ans%= MOD
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
element = defaultdict(int)
def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(n**0.5) + 1):
        if n % k == 0:
            return False
    return True

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

    divisors.sort()
    return divisors
ans = 1
N = int(input())
for num in range(1, N+1):
    div = make_divisors(num)
    while num > 1:
        for d in div[1:]:
            if num % d == 0:
                element[d] += 1
                num //= d
                break
    # print(num, element)
for v in element.values():
    ans *= (v+1)
    ans %= (10**9+7)
print(ans)

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())
d = dict()
for i in range(2, n + 1):
    c = Counter(prime_factorize(i))
    for j in c:
        if not j in d.keys():
            d[j] = c[j]
        else:
            d[j] += c[j]
ans = 1
for i in d.values():
    ans *= i + 1
print(ans % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())

    primes = defaultdict(int)
    for n in range(2, N + 1):
        tmp = n
        if n == 2:
            primes[2] += 1
            continue

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

        if tmp != 1:
            primes[tmp] += 1

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# 100以下の素数を求める
primes = [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]
pi_100 = len(primes)

mod = 10**9+7

prime_vector = [0]*pi_100

N = int(input())
for n in range(2,N+1):
    # calc prime
    for i in range(pi_100):
        while n % primes[i] == 0:
            prime_vector[i] += 1
            n = n//primes[i]

ret = 1

# print(prime_vector)
for i in range(pi_100):
    ret = (ret * (prime_vector[i]+1)) % mod

print(ret)

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline().strip())

def factorization(n):
    arr = []
    temp = n
    # sqrtまで
    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

# 素因数とその出現回数
factors = {}
for i in range(1, N+1):
    tmp = factorization(i)
    # print(tmp)
    for factor, count in tmp:
        if factor not in factors:
            factors[factor] = 0
        factors[factor] += count
# print(factors)

ans = 1
for factor, count in factors.items():
    ans *= (count + 1)
    ans %= 10**9 + 7

print(ans)

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i): is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res
## libs ##
import itertools as it
import functools as ft
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#
def main():
    n = II()
    DIV = 10**9+7
    divp = [1]*10**3
    for i in range(1,n+1):
        for p in prime_factor(i):
            divp[p] += 1
    print((ft.reduce(lambda x,y: x*y, divp))%DIV)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def f(num, ret):
    for i in range(2, min(num+1, int(num**0.5) + 5)):
        if not num % i:
            ret.append(i)
            return f(num//i, ret)
    if num != 1: ret.append(num)
    return ret


from collections import Counter
n = int(input())
l = []
prime = [1]*(n+1)
prime[0] = 0
prime[1] = 0
for i in range(2, n+1):
    if prime[i]:
        l.append(i)
        for j in range(i*2, n+1, i):
            if prime[j]:
                r = f(j, [])
                for ri in r: l.append(ri)
                prime[j] = 0
l = Counter(l)
res = 1
for v in l.values():
    res *= (v+1)
    res %= 10**9+7
print(res)

Submission status: Accepted

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

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())
dic = {}
for i in range(2, n+1):
    l = factorization(i)
    for j in range(len(l)):
        if l[j][0] not in dic.keys():
            dic[l[j][0]] = 1
        else:
            dic[l[j][0]] += l[j][1]
ans = 1
for i in dic.keys():
    ans *= dic[i]+1
MOD = 10**9+7
print(ans%MOD)

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
count = [0]*1000
for i in range(1,n+1):
    arr = factorization(i)
    for so in arr:
        count[so[0]]+=so[1]

ans = 1
count = count[2:]

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

Submission status: Accepted

Solution code:
def prime_pair(n):
    pairs = {}
    tmp = n
    for i in range(2, n):
        if i * i > n:
            break
        if tmp % i != 0:
            continue
        ex = 0
        while tmp % i == 0:
            ex += 1
            tmp /= i
        pairs[i] = ex
    if tmp != 1:
        pairs[int(tmp)] = 1
    return pairs

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

pp = {}
for i in range(N):
    i_pair = prime_pair(i+1)
    for k in i_pair.keys():
        if k in pp.keys():
            pp[k] += i_pair[k]
        else:
            pp[k] = i_pair[k]
res = 1
for p in pp.keys():
    res *= (pp[p] + 1)
    res %= MOD
print(res)

Submission status: Accepted

Solution code:
def primes(n):
  flags = [True] * (n + 1)
  flags[0] = False
  flags[1] = False
  for i in range(2, int(n ** 0.5) + 1):
    if not flags[i]:
      continue
    for j in range(2 * i, n + 1, i):
      if j % i == 0:
        flags[j] = False
  return [i for i in range(n + 1) if flags[i]]

n = int(input())
P = primes(n)
total = 1
counts = [0] * (n + 1)
for i in range(2, n + 1):
  for p in P:
    num = p
    count = 0
    while i % num == 0:
      num *= p
      count += 1
    counts[p] += count
for p in P:
  if counts[p] > 0:
    total = (total * (counts[p] + 1)) % (10 ** 9 + 7)
print(total)

Submission status: Accepted

Solution code:
import math

def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False
    return True

    
N = int(input())
total = 1
mod = 10**9+7
kaijo_ = math.factorial(N)
for i in range(1,N+1):
    cnt = 0
    n = kaijo_
    if isPrime(i):
        while n % i == 0:
            n = n // i
            cnt += 1
        total = (total*(cnt+1))%mod
print(total)

Submission status: Accepted

Solution code:
import sys
import os

def file_input():
    f = open('ARC067/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())

    p=10**9+7

    arr = dict()

    for j in range(N):
        tmp = j+1
        # print("tmp="+str(tmp))
        for i in range(2,int(-(-N**0.5//1))+1):
            if tmp%i==0:
                cnt=0
                while tmp%i==0:
                    cnt+=1
                    tmp//=i
                # print("i="+str(i)+" c="+str(cnt))
                if i in arr:
                    arr[i]+=cnt
                else:
                    arr[i]=cnt

        if tmp!=1:
            # print("i="+str(tmp)+" c=1")
            if tmp in arr:
                arr[tmp]+=1
            else:
                arr[tmp]=1

    # print(arr)
    out=1
    for i in arr.values():
        out*=i+1
        out%=p


    print(out)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
L=[0]*n

def dev(x):
    num=x
    for i in range(2,-int(-(x**0.5))+1):
        cnt=0
        while num%i==0:
            num //= i
            cnt += 1
        L[i-1] += cnt
    if num>1:
        L[num-1] += 1

for j in range(1,n+1):
    dev(j)

ans=1
for j in range(1,n+1):
    ans *= (L[j-1]+1)

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

Submission status: Accepted

Solution code:
A=int(input())
n_l=[0]*(A+1)
for i in range(1,A+1):
   B=i
   for j in range(2,i+1):
      while B % j ==0:
         B=B//j
         n_l[j]+=1
      if B==1:
         break
ans=1
n_l=list(map(lambda x:x+1,n_l))
for i in n_l:
   ans*=i
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()

    cnt = [0] * N
    for i in range(2, N + 1):
        x = i
        for j in range(2, i + 1):
            while x % j == 0:
                x //= j
                cnt[j - 1] += 1
            if x == 1: break

    ret = 1
    for r in cnt:
        ret *= r + 1
        ret %= MOD
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


def trial_division(n):
    # 2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            d[num] += 1
    if n != 1:
        d[n] += 1


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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline
    N = int(input())
    counter = defaultdict(int)
    for i in range(2, N+1):
        while i % 2 == 0:
            counter[2] += 1
            i //= 2
        f = 3
        while f * f <= i:
            if i % f == 0:
                counter[f] += 1
                i //= f
            else:
                f += 2
        if i != 1:
            counter[i] += 1
    ans = 1
    mod = 10**9 + 7
    for v in counter.values():
        ans *= (v+1)
        ans %= mod
    print(ans%mod)
if __name__ == '__main__':
    main()

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

tmp=[]
for i in range(1,N+1):
  tmp += prime_factorize(i)
d=dict(Counter(tmp))
ans=1
for i in d:
  ans = ans*(d[i]+1)%p
print(ans)

Submission status: Accepted

Solution code:
def pf(N):
    prime=[]
    for i in range(2,N+1):
        cond=True
        for j in range(2,round(i**0.5)+1):
            if i%j==0:
                cond=False
        if cond:
            prime.append(i)
    return prime

mod=10**9+7
N=int(input())
ans=1
PF=pf(N)
n=len(PF)
Fs=[1 for _ in range(n)]

for i in range(2,N+1):
    nex=i
    j=0
    while nex>1:
        if nex%PF[j]==0:
            nex//=PF[j]
            Fs[j]+=1
            Fs[j]%=mod
        else:
            j+=1

for f in Fs:
    ans*=f
    ans%=mod

#print(PF)
#print(Fs)
print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
ans = 1
if n == 1:
    print(1)
    exit()

pf= {}

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

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

print(ans)

Submission status: Accepted

Solution code:
MOD = 10**9+7
def factorize(N):
    n = N
    fact = []
    for i in range(2,int(N**0.5)+1): # intに変換すること
        while(n%i==0):
            n //= i #  整数除算(//)を使うこと
            fact.append(i)
    if n!=1:
        fact.append(n)
    return fact
N = int(input())
cnt = [0] * (N+1)
for n in range(1,N+1):
    fact = factorize(n)
    for f in fact:
        cnt[f] += 1

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

Submission status: Accepted

Solution code:
N = int(input())

primes = set()
for i in range(2,N+1):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)

len_prime = len(primes)
d = dict(zip(list(primes), [1 for i in range(len_prime)]))

for i in range(2, N+1):
    while i != 1:
        for p in primes:
            if i % p == 0:
                d[p]+= 1
                i //= p
res = 1
for i in d.values():
    res*=i
print(res % 1000000007)

Submission status: Accepted

Solution code:
n=int(input())
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
ans=1
cnt=[]
for j in range(1,n+1):
    d=list((prime_decomposition(j)))
    for i in range(len(d)):
        cnt.append(d[i])
cnt.sort()
c=[]
#print(cnt)
for i in range(len(cnt)):
    if i==0:
        a=cnt[i]
        ans+=1
        continue
    if a!=cnt[i]:
        c.append(ans)
        ans=2
        a=cnt[i]
    else:
        ans+=1
c.append(ans)
aa=1
for i in range(len(c)):
    aa*=c[i]
    aa%=10**9+7
print(aa)

Submission status: Accepted

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

for x in range(1,n+1):
    m = x
    i = 2
    while i*i <= m:
        if m%i == 0:
            if i not in prime.keys():prime[i] = 0
            while m%i == 0:
                m = m//i
                prime[i] += 1
        i += 1
    if m != 1:
        if m not in prime.keys():prime[m] = 0
        prime[m] += 1
ans = 1
for q in prime.values():
    ans *= q + 1
    ans %= mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n=int(input())
mod=10**9+7
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=defaultdict(lambda:1)
for i in range(2,n+1):
    l=factorization(i)
    for li in l:
        d[li[0]]+=li[1]
ans=1
for k,v in d.items():
    ans*=v
    ans%=mod
print(ans)

Submission status: Accepted

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

pf=defaultdict(int)

for m in range(2, n+1):
    pf2=defaultdict(int)
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf2[i]=pf2.get(i,0)+1
            m//=i
    if m>1:pf2[m]+=1
    for k in pf2.keys():
        pf[k]+=pf2[k]
mod=10**9+7
ans=1
for k in pf.keys():
    ans*=(pf[k]+1)%mod
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
k = [0] * 1010
p = 0
counter = 2
ans = 1

for i in range(1,N + 1):
    p = i
    counter = 2
    
    while p != 1:
        if p % counter == 0:
            k[counter] += 1
            p /= counter
        else:
            counter += 1
for i in range(1,N + 1):
    ans = ans * (k[i] + 1) % 1000000007
print(ans)

Submission status: Accepted

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

from collections import Counter


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


n = int(readline())
check = []
for i in range(1, n + 1):
    check += prime_decomposition(i)
ans = 1
mod = 10 ** 9 + 7
for v in Counter(check).values():
    ans *= v + 1
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
import math


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())
A=Counter(prime_factorize(math.factorial(n)))
cnt=1
for i in A.values():
    cnt *=i+1
    cnt %=mod
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
pri=[2]
for i in range(3,n+1):
    flag=1
    for j in range(2,int(i**(1/2))+1):
        if i%j==0:
            flag=0
            break
    if flag==1:
        pri.append(i)
l=len(pri)
cnt=[0]*l
for i in range(2,n+1):
    x=i
    for j in range(l):
        while x%pri[j]==0:
            cnt[j]+=1
            x=x//pri[j]
s=1
for j in range(l):
    s*=(cnt[j]+1)
    s%=(10**9+7)
print(s)

Submission status: Accepted

Solution code:
# 素因数分解
def factorization(t):
    arr = []
    temp = t
    for i in range(2, int(-(-t ** 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([t, 1])
    return arr

def solve():
    n = int(input())
    mp = {}
    MOD = 10**9+7
    # 素因数分解
    for i in range(2, n + 1):
        f_list = factorization(i)
        for a in f_list:
            if a[0] in mp:
                mp[a[0]] += a[1]
            else:
                mp[a[0]] = a[1]
    res = 1
    for v in mp.values():
        res = res * (v + 1) % MOD
    print(res)

solve()

Submission status: Accepted

Solution code:

def resolve():
    def dic_factorization(n):
        dic = {}  # 素数:指数
        i = 2
        while i * i <= n:
            while n % i == 0:
                n //= i
                if i in dic:
                    dic[i] += 1
                else:
                    dic[i] = 1
            i += 1
        if n > 1:
            dic[n] = 1
        return dic

    MOD = 10 ** 9 + 7
    N = int(input())
    exp = [0] * (N + 1)
    for i in range(2, N + 1):
        dic_prime = dic_factorization(i)
        for k, v in dic_prime.items():
            exp[k] += v

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

    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
mod = 10 ** 9 + 7
def factorization(n):
    ans = {}
    for j in range(2, n + 1):
        temp = j
        for i in range(2, int(-(-j**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                if i not in ans:
                    ans[i] = cnt % mod
                else:
                    ans[i] += cnt % mod

        if temp!=1:
            if temp not in ans:
                ans[temp] = 1
            else:
                ans[temp] += 1

        if len(ans) == 0 and temp != 1:
            ans[n] = 1
        #print(ans)
    return ans
mod = 10 ** 9 + 7
fact = factorization(n)
ans = 1
for i in fact.values():
    ans *= (i + 1) % mod
    #ans %= mod
print(ans % mod)

Submission status: Accepted

Solution code:
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


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


if __name__ == '__main__':
    N = int(input())

    cnt = {}
    for i in range(1, N + 1):
        res = prime_factorize(i)
        for n in res:
            if n not in cnt:
                cnt[n] = 1
            else:
                cnt[n] += 1

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

    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
sosu=[2]
def bunkai(num):
    flag=True
    for i in range(2,int(num**0.5)+1):
        if num%i==0:
            flag=False
            break
    return flag
for i in range(3,n+1): #素数を見つける
    f=bunkai(i)
    if f:
        sosu.append(i)
#print(sosu)
count=[]
for i in range(len(sosu)):
    s=sosu[i]
    count_=0
    for j in range(2,n+1):
        flag2=True
        while flag2:
            if j%s==0:
                count_+=1
                j=j//s
            else:
                flag2=False
    count.append(count_)
mod=10**9+7
ans=1
for i in range(len(count)):
    ans=ans*(count[i]+1)
    ans=ans%mod
#print(count)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
sosu=[2]
def bunkai(num):
    flag=True
    for i in range(2,int(num**0.5)+1):
        if num%i==0:
            flag=False
            break
    return flag
for i in range(3,n+1): #素数を見つける
    f=bunkai(i)
    if f:
        sosu.append(i)
#print(sosu)
count=[]
for i in range(len(sosu)):
    s=sosu[i]
    count_=0
    for j in range(2,n+1):
        flag2=True
        while flag2:
            if j%s==0:
                count_+=1
                j=j//s
            else:
                flag2=False
    count.append(count_)
mod=10**9+7
ans=1
for i in range(len(count)):
    ans=ans*(count[i]+1)
    ans=ans%mod
#print(count)
print(ans)

Submission status: Accepted

Solution code:
import math
def factrize(x):
    f = {}
    if x == 1:
        return f
    tmp = x
    i = 2
    while i**2 <= tmp:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = tmp//i
        if cnt > 0:
            f[i] = cnt
        i += 1
    if tmp != 1 or f == {}:
        f[tmp] = 1
    return f
p = 10**9+7
N =int(input())
a = factrize(math.factorial(N))
A = list(a.values())
ans =1
for i in A:
  ans = (ans * (i+1)) % p
print(ans)