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 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]  
    n = int(input())
    d = defaultdict(int)
    for x in range(2, n+1):
        i = 2
        xd = x
        while i * i <= xd:
            while x % i == 0:
                x //= i
                d[i] += 1
            i += 1
        if x != 1:
            d[x] += 1
    ans = 1

    for k in d:
        ans *= (d[k] + 1)
        ans %= MOD

    print(ans)

    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""
a b a
d c d
a b a
"""

Submission status: Accepted

Solution code:
n=int(input())
num=[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
for i in range(1,n+1):
    num1=factorization(i)
    for j in range(len(num1)):
        num[num1[j][0]]+=num1[j][1]
ans=1
for i in range(2,n+1):
    if num[i]!=0:
        ans=(ans*(num[i]+1))%(10**9+7)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import collections

N = int(input())
a = math.factorial(N)
b = []
while a % 2 == 0:
    b.append(2)
    a//=2
f = 3
while f*f <= a:
    if a % f ==0:
        b.append(f)
        a //= f
    else:
        f += 2
if a != 1:
    b.append(a)

c = collections.Counter(b)
ans = 1
for j,k in c.items():
    ans *= (k+1)
print(ans%(10**9+7))

Submission status: Accepted

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

def sieve(n):
    if( n <= 1):
        return []
    elif(n==2):
        return [2]

    primes = [2]
    primes_append = primes.append
    len_list = (n+1)//2
    flags = [True] * len_list
    flags[0] = False
    for i in range(len_list):
        if(flags[i]):
            primes_append(i*2+1)
            start = ((i*2+1)**2)//2
            for j in range( start, len_list, i*2+1):
                flags[j] = False
    return primes

primes = sieve(1000)
ans = 1
for p in primes:
    tmp = 1
    x = n
    while(x>0):
        x //= p
        tmp += x
    ans *= tmp
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
def p_fact(n,a):
  m=n
  i=2
  while n>1:
    if i>m**.5 and n!=1:
      a.append(n)
      break
    if n%i==0:
      n//=i
      a.append(i)
    else:i+=1  
  return a
n=int(input())
mod=10**9+7
a=[]
for i in range(2,n+1):
  a+=p_fact(i,[])
ans=1
for i in Counter(a).values():
  ans=ans*(i+1)%mod
print(ans%mod)

Submission status: Accepted

Solution code:
from collections import Counter

def prime_decomposition(n: int) -> list:
    """素因数分解"""
    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

MOD = 10 ** 9 + 7
N = int(input())
factors = []
for i in range(1, N+1):
    factors += prime_decomposition(i)
counter = Counter(factors)
ans = 1
for k, v in counter.items():
    if k == 1: continue
    ans *= (v+1)
    ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import Counter
from functools import reduce
from operator import mul
n = int(open(0).read().rstrip())
c = Counter()

sieve = [True]*(n+1)
sieve[0] = sieve[1] = False

tmp = n
while tmp:
    c[2] += tmp//2
    tmp //= 2

for i in range(4, n+1, 2):
    sieve[i] = False
for i in range(3, n+1, 2):
    if sieve[i]:
        tmp = n
        while tmp//i:
            c[i] += tmp//i
            tmp //= i
        for j in range(2*i, n+1, i):
            sieve[j] = False

ans = 1
for x in sorted(c.values()):
    ans *= x+1
    ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
M = 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

from collections import Counter

ct = Counter()
for t in range(2, N+1):
    pf = prime_factorize(t)
    ct.update(pf)

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

# print(ct)
print(ans)

Submission status: Accepted

Solution code:
def prime_number(n):
    lis= []
    for i in range(2,n+1):
        j = 2
        flag = 0
        
        while j*j <= i:
            if i%j ==0:
                flag = 1
                break
            else:
                j +=1
        if flag ==0:
            lis.append(i)
    return lis



N= int(input())
m = 10**9+7
pri_num = prime_number(N)
dic = {}

for i in range(2,N+1):
    for pri in pri_num:
        while i>0:
            if i % pri == 0:
                if pri in dic:
                    dic[pri] +=1
                else:
                    dic[pri]=1
                i = i//pri

            else:
                break

count = 1
for val in dic.values():
    count = (count*(val+1))%m
print(count)

Submission status: Accepted

Solution code:
N= int(input())

m = 10**9+7
pri_num = [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]
dic = {}

for i in range(2,N+1):
    for pri in pri_num:
        while i>0:
            if i % pri == 0:
                if pri in dic:
                    dic[pri] +=1
                else:
                    dic[pri]=1
                i = i//pri

            else:
                break

count = 1
for val in dic.values():
    count = (count*(val+1))%m
print(count)

Submission status: Accepted

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()

primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)

a = [0]*len(primes)
for i in range(len(primes)):
    for j in range(1, n+1):
        tmp = j
        while tmp % primes[i] == 0:
            tmp = tmp // primes[i]
            a[i] += 1

ans = 1
for x in a:
    ans = ans * (x + 1) % (10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

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 prime_fact(N):
    n = 2
    prime = []
    while n * n <= N:
        i = 0
        while N % n == 0:
            N //= n
            i += 1
        if i > 0:
            prime.append((n, i))
        n += 1
    if N != 1:
        prime.append((N, 1))
    return prime


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

    N = ii()

    cnt = [0] * (N+1)
    for n in range(1, N+1):
        prime = prime_fact(n)
        for q, e in prime:
            cnt[q-1] += e

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


mod = 10**9 + 7


def factorize_dict(n):
    b = 2
    fct = defaultdict(lambda: 0)
    while b ** 2 <= n:
        while n % b == 0:
            n //= b
            fct[b] += 1
        b += 1
    if n > 1:
        fct[n] += 1
    return fct


def main():
    N = in_n()

    prime = defaultdict(int)
    for n in range(1, N + 1):
        d = factorize_dict(n)
        for k, v in d.items():
            prime[k] += v

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

n = int(input())
mod = pow(10,9)+7
ans = 1
F = Counter()
for i in range(1,n+1):
    F += Counter(facto(i))

del F[1]
for key, val in F.items():
    ans *= val+1
print(ans%mod)

Submission status: Accepted

Solution code:
def main():
    mod = 1000000007
    N = int(input())
    prime = [1] * (N+1)
    prime[0] = 0
    prime[1] = 0
    for i in range(2,N+1):
        if prime[i] == 1:
            p = i
            j = 2
            while p*j <= N:
                prime[p*j] = 0
                j += 1

    res = 1
    for i in range(2,N+1):
        if prime[i] == 1:
            p = i
            j = 1
            num = 0
            while p**j <= N:
                num += N // (p**j)
                j += 1
            res *= (num+1)
            res %= mod

    print(res)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict
n=int(input())
k=[i for i in range(2,n+1)]
d=defaultdict(int)
c=1

for i in range(2,n+1):
  while i%2==0:
    i//=2
    d[2]+=1
  f=3
  while f<i:
    if i%f==0:
      i//=f
      d[f]+=1
    else:
      f+=2
  if i !=1:
   d[i]+=1

for v in d.values():
  c=(c*(v+1))%(10**9+7)
print(c)

Submission status: Accepted

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

sos=[]
for i in range(2,n+1):
    for ele in sos:
        if i%ele==0:
            break
    else:
        sos.append(i)
ans=1
for ele in sos:
    cnt=1
    cha=ele
    while n>=cha:
        cnt+=n//cha
        cha*=ele
    ans*=cnt
    ans%=mod
    #print(ele,cnt)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
mod=10**9 + 7
import math
from collections import Counter
#試し割法
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

ans=[]
for i in range(1,n+1):
    arr=factorize(i)

    ans.append(arr)

ans=sum(ans,[])

c=list(Counter(ans).values())
cnt=1
for j in c:
    cnt*=(j+1)

print(cnt%mod)

Submission status: Accepted

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

n = int(input())

soinsu = {}
for i in range(1,n+1):
    f = factorization(i)
    for r in f:
        if r[0] not in soinsu:
            soinsu[r[0]] = r[1]
        else:
            soinsu[r[0]] += r[1]

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n, = map(int,readline().split())

MOD = 10**9+7

ans = 1

p = [1]*1001
for i in range(2,1001):
    if p[i]:
        v = 0
        nn = n
        while nn:
            v += nn//i
            nn//= i
        #print(i,v)
        ans *= v+1
        ans %= MOD
        p[i::i] = [0]*(1000//i)

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt


def factor(N):
    f = {}
    for i in range(2, int(sqrt(N))+1):
        e = 0
        while N % i == 0:
            e += 1
            N /= i
        if e != 0:
            f[i] = e
    if N != 1:
        f[N] = 1
    return f


def solver(N):
    f = {}
    for i in range(1, N+1):
        for p, e in factor(i).items():
            if f.get(p) is None:
                f[p] = 0
            f[p] += e
    ans = 1
    for p, e in f.items():
        ans *= (e+1)
    ans %= 10**9+7
    return ans


if __name__ == "__main__":
    N = int(input())
    print(solver(N))

Submission status: Accepted

Solution code:
import sys
from collections import Counter

input = sys.stdin.readline
P = 10 ** 9 + 7


def calc_prime_factors(n):
    """Trial division"""
    factors = []
    # factor: 2
    while n % 2 == 0:
        factors.append(2)
        n //= 2
    # factor: 3, 5, 7, 11, ...
    f = 3
    root_n = int(n ** 0.5) + 1
    while f <= root_n:
        if n % f == 0:
            factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factors.append(n)
    factors = Counter(factors).items()
    return factors


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

    count = [1] * 1001

    for i in range(1, N + 1):
        factors = calc_prime_factors(i)
        for k, v in factors:
            count[k] += v

    ans = 1
    for c in count[1:]:
        ans = (ans * c) % P

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
MOD = 10**9 + 7


def main():
    from collections import Counter

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

    c = Counter()
    N = int(input())
    for p in range(2, N+1):
        divs = prime_factorize(p)
        for d, v in divs:
            c[d] += v
    ans = 1
    for v in c.values():
        ans *= (v+1)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
MOD = 10**9 + 7


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

    c = [0]*1001
    N = int(input())
    for p in range(2, N+1):
        divs = prime_factorize(p)
        for d, v in divs:
            c[d] += v
    ans = 1
    for i in range(2, N+1):
        if c[i] == 0:
            continue
        ans *= (c[i]+1)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
MOD = 10**9 + 7


def main():
    def Eratosthenes(x: int) -> set:
        """x以下の素数の集合を返す"""
        primes = {i for i in range(2, x+1)}
        for i in range(2, N+1):
            if i*i > N:
                break
            if i in primes:
                mul = 2
                while i*mul <= x:
                    primes.discard(i*mul)
                    mul += 1
        return primes

    N = int(input())
    ans = 1
    pf = Eratosthenes(N)
    for p in pf:
        i = 1
        cnt = 0
        while N//pow(p, i) > 0:
            cnt += N//pow(p, i)
            i += 1
        ans *= cnt + 1
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

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 == [] and n != 1:
        arr.append([n, 1])

    return arr

N = int(input())

d = dict()
for i in range(1, N + 1):
    a = factorization(i)
    for aa in a:
        if aa[0] in d:
            d[aa[0]] += aa[1]
        else:
            d[aa[0]] = aa[1]

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

print(res)

Submission status: Accepted

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

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

factorial = [0] * (n+1)
factorial[0] = 1
for i in range(1, n+1):
    factorial[i] = (factorial[i-1] * i)

n = factorial[n]
prime_factors = []
i = 2
while i ** 2 <= n:
    ext = 0
    while n % i == 0:
        ext += 1
        n //= i
    if ext:
        prime_factors.append((i, ext))
    i += 1
if n != 1:
    prime_factors.append((n, 1))

ans = 1
for pf, num in prime_factors:
    ans = (ans * (num + 1)) % MOD
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

n=int(input())

mod=10**9+7

def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

ha=[]
for i in range(1,n+1):
  l=factorization(i)
  ha+=l

c=Counter(ha)

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

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

def prime(n): #O(√n)で素因数分解結果を返す
    dic = defaultdict(int)
    i=2
    while i*i<=n:
        while n%i==0:
            n//=i
            dic[i]+=1
        i+=1
    if n!=1: dic[n]=1
    return dict(dic)

n=int(input())
dic=defaultdict(int)
for i in range(n):
    temp=prime(i+1)
    for key in temp.keys():
        dic[key]+=temp[key]

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import Counter

def read():
    N = int(input().strip())
    return N,


def sieve(n):
    """
    n以下の素数を昇順に列挙する
    """
    is_prime = [True for i in range(n+1)]
    primes = []
    for i in range(2, n+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i+i, n+1, i):
                is_prime[j] = False
    return primes


def prime_factorization(n, primes):
    """
    nの素因数分解を求める
    """
    prime_factors = Counter()
    if n < 2:
        return prime_factors
    for p in primes:
        if p * p > n:
            break
        while n % p == 0:
            prime_factors[p] += 1
            n //= p
    if n > 1:
        prime_factors[n] = 1
    return prime_factors


def solve(N, p=10**9+7):
    primes = sieve(N)
    factors = Counter()
    for i in range(1, N+1):
        f = prime_factorization(i, primes)
        factors += f
    ans = 1
    for v in factors.values():
        ans *= (v+1)
        ans %= p
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

Solution code:
def sieve(n):
    data = [k for k in range(2,n+1)]
    for d in data:
        data = [x for x in data if (x==d or x%d != 0)]
    return data

def fact(n,prime,arr):
    temp = n
    for i in prime:
        if i > n:
            break
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                temp //= i
                cnt += 1
            arr[i] += cnt
    if temp != 1:
        arr[temp] += 1
    if arr == []:
        arr[n] += 1
    return None

n = int(input())
prime = sieve(n)
arr = [0]*(n+1)
for i in range(2,n+1):
    fact(i,prime,arr)
    
ans = 1
for k in arr:
    if k == 0:
        continue
    ans = (ans*(k+1))%(1e+9+7)

print(int(ans))

Submission status: Accepted

Solution code:
from collections import Counter
from functools import reduce


def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        return res + [n]
    else:
        return res


N = int(input())
MOD = 10 ** 9 + 7
factors = reduce(lambda x, y: x + y, [factor(i) for i in range(1, N + 1)])
ans = 1
for v in Counter(factors).values():
    ans *= v + 1
    ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
mod = 10**9 + 7


n = int(input())

is_prime = [True] * 1001
is_prime[0] = is_prime[1] = False
for i in range(1001):
    if is_prime[i]:
        j = 2
        while i * j <= 1000:
            is_prime[i * j] = False
            j += 1
P = [i for i in range(1001) if is_prime[i]]

A = {p:1 for p in P}
for i in range(2, n + 1):
    for p in P:
        while i % p == 0:
            i //= p
            A[p] += 1
        if i == 1:
            break

ans = 1
for a in A.values():
    ans *= a
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
def fact(A): #fact(int)
    c0 = A
    r = 2
    lis = []
    count = 1
    while A != 1:
        if A%r == 0:
            A = A//r
            lis.append(r)
            r = 2
        else:
            r += 1
        if r > int(pow(c0,0.5))+1:
            lis.append(A)
            break
    return(lis)
n = int(input())
m = 10**9+7
lis = []
for i in range(2,n+1):
    L = fact(i)
    lis.extend(L)
import collections
c = collections.Counter(lis)
A = list(set(lis))
ans = 1
for a in A:
    ans *= c[a] + 1
    ans = ans%m
print(ans%m)

Submission status: Accepted

Solution code:
import collections

mod = 10**9+7 

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())
#print(prime_factor(N))
ans = [0] * (N+1)
for i in range(2,N+1):
    L = collections.Counter(prime_factor(i))
    values,counts = zip(*L.most_common())
    for v in values:
        ans[v] += L[v]
A = 1
for i in ans:
    A *= (i+1)
    A %= mod
print(A)

Submission status: Accepted

Solution code:
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def main():
    N = int(input())
    dic = {}
    ans = 1
    for i in range(1, N+1):
        for v in prime_decomposition(i):
            if not v in dic:
                dic[v] = 0
            dic[v] += 1

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
MOD = 10**9 + 7
n = int(input())
chk = [0 for i in range(n+1)]
for i in range(2, n+1):
    y = 2
    while y*y <= i:
        while i % y == 0:
            chk[y] += 1
            i //= y
        y += 1
    if i > 1:
        chk[i] += 1

ans = 1
for i in chk:
    if i:
        ans = ans*(i + 1)%MOD
print(ans)

Submission status: Accepted

Solution code:
import collections
def e(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res
MOD = 10**9 + 7
n = int(input())
chk = [0 for i in range(n+1)]
for i in range(2, n+1):
    tmp = collections.Counter(e(i))
    for j in tmp:
        chk[j] += tmp[j]
ans = 1
for i in chk:
    if i:
        ans = ans*(i + 1)%MOD
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
dic = defaultdict(lambda : 0)
def decomp(num, dic):
    sqrt = round(num **0.5) + 1
    z = num
    for i in range(2, sqrt + 1):
        if not z % i:
            count = 0
            while z % i == 0:
                count += 1
                z //= i
            dic[i] += count
    if z > 1:
        dic[z] += 1
for i in range(2, n + 1):
    decomp(i, dic)
ans = 1
for i in dic.values():
    ans *= i + 1
print(ans % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
n = int(input())
M = 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])
    ans = []
    for i, a in enumerate(arr):
        for j in range(a[1]):
            ans.append(a[0])
    return ans
val = 1
if n == 1:
    print(1)
    exit()
ans = 1
ary = []
for i in range(2,n+1):
    ary.extend(factorization(i))
import collections
cnt = collections.Counter(ary).most_common()
for j, tmp in enumerate(cnt):
    ans *= tmp[1] + 1
    ans %= M

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

mod = 10**9 + 7
table = {}

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

    tmp = i
    div = 2
    while tmp >= div:
        if tmp % div == 0:
            if div not in table:
                table[div] = 1
            else:
                table[div] += 1
            tmp //= div
        else:
            div += 1

ans = 1

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

print(ans)

Submission status: Accepted

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

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

factorial = [0] * (n+1)
factorial[0] = 1
for i in range(1, n+1):
    factorial[i] = factorial[i-1] * i

prime_factors = []
target = factorial[n]
i = 2
while i ** 2 <= target:
    if target % i != 0:
        i += 1
        continue

    ext = 0
    while target % i == 0:
        ext += 1
        target //= i

    prime_factors.append((i, ext))
    i += 1

if target != 1:
    prime_factors.append((target, 1))

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

print(ans)

Submission status: Accepted

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

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

factorial = [0] * (n+1)
factorial[0] = 1

for i in range(1, n+1):
    factorial[i] = factorial[i-1] * i
target = factorial[n]

prime_factors = []

i = 2
while i ** 2 <= target:
    if target % i != 0:
        i += 1
        continue
    ext = 0
    while target % i == 0:
        ext += 1
        target //= i

    prime_factors.append((i, ext))
    i += 1

if target != 1:
    prime_factors.append((target, 1))

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

print(ans)

Submission status: Accepted

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

MOD = 10 ** 9 + 7

n = int(input())

factorial = [0] * (n + 1)
factorial[0] = 1

for i in range(1, n + 1):
    factorial[i] = factorial[i-1] * i

prime_factors = []

i = 2
target = factorial[n]
while i ** 2 <= target:
    if target % i != 0:
        i += 1
        continue

    ext = 0
    while target % i == 0:
        ext += 1
        target //= i
    prime_factors.append((i, ext))
    i += 1

if target != 1:
    prime_factors.append((target, 1))

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

Submission status: Accepted

Solution code:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
mp = {}

def divisor(n):
    p = 3
    d = {}
    while n>1:
        if n%2==0:
            d[2] = 0
        while n%2==0:
            n /= 2
            d[2] += 1
        if n%p==0:
            d[p] = 0
        while n%p==0:
            n /= p
            d[p] += 1
        p += 2
    return d

divs = {}
for i in range(2, n+1):
    for k, v in divisor(i).items():
        if k in divs:
            divs[k] += v
        else:
            divs[k] = v

# print(divs)
res = 1
for k, v in divs.items():
    res *= (v+1)
    res %= mod

print(res)

Submission status: Accepted

Solution code:
def pfact(n):
    d = {}
    while n % 2 == 0:
        d[2] = 1 if 2 not in d else d[2] + 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            d[f] = 1 if f not in d else d[f] + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = 1 if n not in d else d[n] + 1
    return d

n = int(input())
MOD = 10 ** 9 + 7
d = {}
for i in range(1, n+1):
    for k, v in pfact(i).items():
        d[k] = v if k not in d else d[k] + v
ans = 1
for k, v in d.items():
    ans *= v + 1
    ans %= MOD
print(ans)