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:
N=int(input())
pf={}
m=0
insuu=[0]*(N+1)
p=10**9+7
for i in range(1,N+1):
    m=i
    for j in range(2,int(m**0.5)+1):
        while m%j==0:
            pf[j]=pf.get(j,0)+1
            m//=j
    if m>1:pf[m]=1
    #print(pf)
    keys=list(pf.keys())
    values=list(pf.values())
    pf={}
    for j in range(len(keys)):
        insuu[keys[j]]=insuu[keys[j]]+values[j]
    #print(insuu)
    #input()
    #print(l)	#これでlistになった
ans=1
for i in range(N+1):
    if insuu[i]>0:
        ans=(ans*(insuu[i]+1))%p
print(ans%p)

Submission status: Accepted

Solution code:
sosu = [2]
A = 10 ** 9 + 7
N = int(input())
man = []
buriburi = 1
n = [0] * 1000

def prime(a):
    flag = 0
    m = a
    for i in range(2,m):
        if m % i == 0:
            flag = 1
            break
    if flag == 0:
        sosu.append(a)

for i in range(3,1001,2):
    prime(i)

for i in sosu:
    for j in range(N,1,-1):
        mod = j
        while mod % i == 0:
            n[i] += 1
            mod = mod // i

for i in n:
    if i != 0:
        buriburi *= i + 1

print(buriburi % A)

Submission status: Accepted

Solution code:

mod=10**9+7

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

# ===========================素数判定 1:2以上の素数　,0：倍数    
def isPrime(x):
    if x < 2:
        return 0
    elif x == 2:
        return 1
    if x%2 == 0:
        return 0
    ir=int(x**(0.5))+1
    for i  in range(3,ir,2) :
        if x%i == 0:
            return 0
    return 1

n=int(input())

p=[]
for i in range(n+1):
    if isPrime(i):
        p.append([i,0])
        
for i in range(2,n+1):
    for j in range(len(p)):
        ii=i
        ip=0
        while ii>=p[j][0]:
            if ii%p[j][0]==0:
                ip=ip+1
                ii=ii//p[j][0]
            else:
                break
        p[j][1]=p[j][1]+ip

psum=1
for j in range(len(p)):
    if p[j][1]!=0:
        psum=mul(psum,p[j][1]+1)

print(psum)

Submission status: Accepted

Solution code:
import sys
n = int(input())
a = []

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

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

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

a.sort()
c = []
count = 1
for i in range(1,len(a)):
    if(a[i-1]!=a[i]):
        c.append(count)
        count = 1
    else:
        count += 1
c.append(count)

ans = 1
for i in range(0,len(c)):
    ans *= (c[i]+1)
print(ans % 1000000007)

Submission status: Accepted

Solution code:
from collections import Counter
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

lst=[]
for i in range(n):
    lst.extend(prime_factorize(i+1))
lst=Counter(lst)
ans=1
INF=1000000007
for i in lst.values():
    ans*=i+1
    ans%=INF
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

sosu = []
#エラトステネスの篩
primes = list(range(n+1))
primes[1] = 0
for i in range(2,int(n**.5)+1):
    if primes[i]!=0:
        for j in range(i*2,n+1,i):
            primes[j] = 0
primes = [prime for prime in primes if prime!=0]

power = []
for prime in primes:
    p = prime
    tmp = 0
    while p<=n:
        tmp += n // p
        p *= prime
    power.append(tmp)
#print(power)

res = 1
mod = 10**9+7
for i in power:
    res *= i + 1
    res %= mod

print(res)

Submission status: Accepted

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

for value in arr.values():
    ans*=(value+1)
    
# print(arr)
print(ans%mod)




# x=0
# k = ans
# for i in range(1,int(k**0.5)+1):
#     if k%i==0:
#         x+=1
#         if i!=n//i:
#             x+=1
# print(x%mod)

Submission status: Accepted

Solution code:
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f


n=int(input())
mod=1000000007
ans=1
l=[1 for _ in range(n)]
for i in range(2,n+1):
  f=fctr1(i)
  for x,y in f:
    l[x-1]+=y
for x in l:
  ans*=x
  if ans>=mod:
    ans%=mod

#print(l)
print(ans)

Submission status: Accepted

Solution code:
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
n=int(input())
l=[0]*(n+1)
for i in range(1,n+1):
    c=prime_factorize(i)
    #print(c)
    for j in range(len(c)):
        l[c[j]]+=1
#print(l)
ans=1
for i in range(n+1):
    if l[i]!=0:
        ans=ans*(l[i]+1)%(10**9+7)
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
n=int(input())
#w,h,x,y,r=map(int,input().split())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
#素因数分解した結果を2次元配列にして返す
def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist
dic={}
for i in range(1,n+1):
    pfs=prime_factorize(i)
    for pf in pfs:
        dic[pf[0]]=dic.get(pf[0],0)+pf[1]
#print(dic)
ans=1
mod=10**9+7
for v in dic.values():
    ans=(ans*(v+1))%mod
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
import math

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

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
pr=callIsPrime(1000)
ans=1
for i in range(len(pr)):
  count=0
  j=1
  while(N>=pr[i]**j):
    count+=N//(pr[i]**j)
    j+=1
  ans=(ans*(count+1))%(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import math
MOD=1000000007
N=int(input())
f=[0]*1000

def factors(n):
  for i in range(2,n+1):
    if n==1: return
    if n%i==0:
      while n%i==0:
        f[i]+=1
        n//=i

for i in range(2,N+1):
  factors(i)

ans=1
for i in range(1000):
  if f[i]>0:
    ans*=(f[i]+1)
    ans%=MOD

print(ans)

Submission status: Accepted

Solution code:
pf = {}
ans = 1
m = int(input())
for i in range(2, m+1):
    for j in range(2, int(i**0.5)+1):
        while i%j==0:
            pf[j]=pf.get(j,0)+1
            i//=j
    if i>1:
        pf[i]=pf.get(i,0)+1

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

Submission status: Accepted

Solution code:
pf = {}
ans = 1
m = int(input())
for i in range(2, m+1):
    for j in range(2, int(i**0.5)+1):
        while i%j==0:
            pf[j]=pf.get(j,0)+1
            i//=j
    if i>1:
        if i in pf.keys():
            pf[i]+=1
        else:
            pf[i]=1

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

Submission status: Accepted

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

prime=[]
for n in range(2, 1001):
    for i in range(2,n):
        if n % i == 0:
            break
    else:
        prime.append(n)
#print(prime)

bucket={}
for p in prime:
    bucket[p]=0
#print(bucket)

for i in range(2, N+1):
    for p in prime:
        if p > i:
            break
        #print(i,p)
        while i % p == 0:
            i //= p
            bucket[p] += 1

#print(bucket)

ans=1
for p in prime:
    ans = (ans * (bucket[p] + 1)) % MOD

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

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()
d=defaultdict(int)
for i in range(2,n+1):
    tmp=factorization(i)
    for j in tmp:
        yaku,ko=j
        d[yaku]+=ko
# print(d)
ans=1
for i in d.values():
    ans*=i+1
    ans%=mod
print(ans)

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

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


def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        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

N = iin()
ex = [0 for _ in range(N+1)]
for i in range(2, N+1):
    pf = prime_factorize(i)
    for p in pf:
        ex[p[0]] += p[1]
ans = 1
for i in range(2, N+1):
    ans *= ex[i]+1
    ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

#素因数分解した結果を2次元配列にして返す
def prime_factorize(n):
    primelist=[]
    a=2
    n_origin=n
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist
mod=10**9+7
dic={}
ans=1
for i in range(2,n+1):
    pfs=prime_factorize(i)
    for j in range(len(pfs)):
        dic[pfs[j][0]]=dic.get(pfs[j][0],0)+pfs[j][1]
for v in dic.values():
    ans=(ans*(v+1))%mod
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

MOD = 10 ** 9 + 7


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

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

    if not arr and n != 1:
        arr[n] = 1

    return arr


ct = Counter()
for i in range(2, int(input()) + 1):
    ct.update(factorization(i))

ans = 1
for t in ct.values():
    ans = (ans * (t + 1)) % MOD
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

for i in range(2,n+1):
	x = i
	for j in range(2,x+1):
		while x % j == 0:
			x = x // j
			d[j] = d.get(j, 0) + 1

ret = 1
for v in d.values():
	ret *= v+1

print(ret % mod)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# C - Factors of Factorial
# 標準入力の取得
N = int(input())

# N以下の素数リストを作成
prime_number_list = []
for n in range(2, N+1):
    is_prime_number = True
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            is_prime_number = False
    if is_prime_number:
        prime_number_list.append(n)

# N!の約数の計算
# 各素因数の個数を求め、その個数+1をどんどん掛けていく
result = 1
for pn in prime_number_list:
    n = 1
    count = 0
    while pn**n <= N:
        count += N // (pn**n)
        n += 1
    result *= count + 1

# 結果出力
print(result%(pow(10,9)+7))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 10**9+7
from collections import defaultdict
def sieve(N):
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    prime.sort()
    prime.reverse()
    for k in range(N-1):
        if prime[k+1] == 0:
            end = k
            break
    return prime[:end+1]

def main():
    N = int(input())
    if N == 1:
        print(1)
        exit()
    prime = sieve(N)
    prime.reverse()
    lis = defaultdict(int)
    for i in range(1,N+1):
        t = i
        for p in prime:
            if p > i:continue
            if t%p == 0:
                while t%p == 0:
                    t //= p
                    lis[p] += 1
    ans = 1
    for l in lis.values():
        ans *= (l+1)
        ans %= mod
    
    print(ans)

    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt, factorial

n = int(input())

MAX_VAL = n
prime = [1] * (MAX_VAL+1)
prime[0] = prime[1] = 0
for i in range(2, int(sqrt(MAX_VAL))+1):
    if prime[i]:
        for k in range(2*i, MAX_VAL+1, i):
            prime[k] = 0

res = 1
for i, p in enumerate(prime):
    m = factorial(n)
    if p:
        cnt = 0
        while m % i == 0:
            cnt += 1
            m //= i
        res *= cnt + 1
        res %= 10**9+7

print(res)

Submission status: Accepted

Solution code:
from fractions import math
n=int(input())
#first generate all primes uptil N
def chk_prime(n):
    sq=int(math.sqrt(n))
    for i in range(2,sq+1):
        if n%i==0:
            return False
    return True
primes=[]
for i in range(2,n+1):
    if chk_prime(i):
        primes.append(i)
#print(primes)
ans=1
mod=10**9+7
for i in primes:
    cnt=0
    for j in range(i,n+1,i):
        num=j
        while num%i==0:
            num//=i
            cnt+=1
    ans=(ans*(cnt+1))%mod
print(ans)

Submission status: Accepted

Solution code:
import math
from collections import Counter

n = int(input())
prime_count = Counter()
def prime_c(m):
  for i in range(2, math.ceil(math.sqrt(m))+1):
    while m % i == 0:
      m /= i
      prime_count[i] += 1
  if m > 1:
    prime_count[int(m)] += 1  

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

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

Submission status: Accepted

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

waru = 1000000007

def pwari(n):
    th = round(n ** 0.5)
    ans = (n,1)
    for i in range(2,th+1):
        if n % i ==0:
            ans = (i,n//i)
            break
            
    return(ans)

def soinsu(n):
    pf_dic = dd(lambda:0)
    
    flag = 1
    
    while flag:

        waru,red = pwari(n)[:]
        if waru == n:
            pf_dic[str(waru)] += 1
            flag = 0
        else:
            pf_dic[str(waru)] += 1
            n = red
    return(pf_dic)

p_dic = dd(lambda:0)
for i in range(1,N+1):
    pf_dic = soinsu(i)
#     print(i,pf_dic)
    for p in pf_dic.keys():
#         print(i,p,pf_dic[p])
        p_dic[p] += pf_dic[p]

# print("p_dic:",p_dic)
ans = 1
for p in p_dic.keys():
    if p == "1":
        pass
    else:
        ans *= (p_dic[p]+1)
    
print(ans % waru)

Submission status: Accepted

Solution code:
n=int(input())

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

from collections import defaultdict
d = defaultdict(int)
for i in range(1,n):
    num=i+1
    for div in fact(num):
        d[div[0]]+=div[1]

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

Submission status: Accepted

Solution code:
N = int(input())

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

prod = [0]*(N+1)
for i in range(2,N+1):
  for p in factorize(i):
    prod[p] += 1
ans = 1
#print(prod)
for i in range(2,N+1):
  ans *= prod[i]+1
  ans %= 10**9+7
print(ans)

#print(*ans, sep='\n')

Submission status: Accepted

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

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

ans = 1
for i in s:
    ans *= i+1
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:

N = int(input())

isPrime = [True]*(N+1)

isPrime[0] = False
isPrime[1] = False

for i in range(2, N + 1):
    if isPrime[i]:
        for j in range(2*i, N + 1, i):
            isPrime[j] = False


factors = []

for p in range(2, N+1):
    if not isPrime[p]:
        continue

    f = 0
    base = p
    while base <= N:
        f += N // base
        base *= p

    if f > 0:
        factors.append(f)

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

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

facters = {}

for i in range(1, N+1):
  # 約数を求める
  arr = factorization(i)
  for key,value in arr:
    if key in facters:
      facters[key] += value
    else:
      facters[key] = value

ans = 1

facters.pop(1)

for value in facters.values():
  ans *= value + 1 
  ans = ans % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc052/tasks/arc067_a
# C - Factors of Factorial

N = int(input())

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

def get_prime_factor(n):
    from collections import defaultdict
    res = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break
        while n % i == 0:
            res[i] = res[i] + 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res

prime_factor = get_prime_factor(n)

factors_count = 1
for count in prime_factor.values():
    factors_count = factors_count * (count + 1)

res = factors_count % (10 ** 9 + 7)
print(res)

Submission status: Accepted

Solution code:
import collections 
na=int(input())
n=1
mod = 10**9+7
for i in range(2,na+1):
    n*=i
#print(n)

n_break=[]
i=2
while i<=n:
    if n%i==0:
        n_break.append(i)
        n=n//i
    else:
        i+=1
#print(n_break)
ans=1
count=collections.Counter(n_break)
for v in count.values():
    ans*=(v+1)  #約数の総数

print(ans%mod)

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
from itertools import count
from functools import reduce


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


def prime_factor(n):
  c = defaultdict(int)
  for i in count(2):
    if i * i > n:
      break
    while n % i == 0:
      c[i] += 1
      n //= i;
  if n != 1:
    c[n] = 1
  return Counter(c)

counter = reduce(
  lambda a, i: a + prime_factor(i),
  range(N, 1, -1),
  Counter()
)
  
answer = reduce(
  lambda a, c: (a * (c + 1)) % MOD,
  counter.values(),
  1
)

print(answer)

Submission status: Accepted

Solution code:
n = int(input())

INF = 10**9 + 7

s = [0] * (n+1)

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

ans = 1
for i in s:
    ans *= i+1

print(ans % INF)

Submission status: Accepted

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

div = [0 for _ in range(n)]
for i in range(1, n+1):
    x = i
    for j in range(2, x+1):
        while x % j == 0:
            x //= j
            div[j-1] += 1
ans = 1
for i in range(n):
    ans = ans * (div[i] + 1) % mod

print(ans)

Submission status: Accepted

Solution code:
import collections

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

n = int(input())
a = []
for i in range(2,n+1):
    a += prime_factorize(i)
b = set(a)
c = collections.Counter(a)
ans = 1
for i in b:
    ans *= c[i]+1
    ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:

import math
from collections import Counter
from collections import defaultdict
mod = 10**9+7 

def prime(n):
  for i in range(2, math.ceil(math.sqrt(n))+1):
    while n % i == 0:
      n /= i
      prime_count[i] += 1
  if n > 1:
    prime_count[int(n)] += 1

n = int(input())
a = 1
prime_count = defaultdict(int)
for i in range(1, n+1):
  prime(i)

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n=int(input())
mod=10**9+7
d=defaultdict(int)
for i in range(2,n+1):
  c=i
  for j in range(2,c+1):
    if c%j==0:
      cnt=0
      while c%j==0:
        cnt+=1
        c//=j
      d[j]+=cnt
ans=1
for v in d.values():
  ans=(ans*(v+1))%mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

x = 1
for i in range(1, n+1):
    x *= i

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

import collections
c = collections.Counter(prime_factorize(x))
y = list(c.values())

z = 1
for j in range(len(y)):
    z *= (y[j]+1)

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

Submission status: Accepted

Solution code:

def prime_factorize(N):
    res = [0] * (N+1)
    for n in range(2,N+1):
        a = 2
        while a*a <= n:
            if n % a == 0:
                ex = 0
                while n % a == 0:
                    ex += 1
                    n //= a
                #res.append((a, ex))
                res[a] += ex
            a += 1
        if n != 1:
            res[n] += 1
    return res

N = int(input())
prime = prime_factorize(N)

mod = 10 ** 9 + 7
ret = 1
for i in prime:
    ret *= (i+1)
    ret %= mod

print(ret)

Submission status: Accepted

Solution code:
N = int(input())
mod = 1000000007

primes = list()

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

ans = 1
for p in primes:
    x = 1
    q = p
    while q <= N:
        for i in range(2, N+1):
            if i % q == 0:
                x += 1
        q *= p
    ans = ans * x % mod

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

divisor_dic = {}

for i in range(1, n+1):
    while i % 2 == 0:
        if not 2 in divisor_dic:
            divisor_dic[2] = 1
        else:
            divisor_dic[2] += 1
        i //= 2
    f = 3
    while f*f <= i:
        if i % f ==0:
            if not f in divisor_dic:
                divisor_dic[f] = 1
            else:
                divisor_dic[f] += 1
        
            i //= f
        
        else:
            f += 2
    
    if i != 1:
        if not i in divisor_dic:
            divisor_dic[i] = 1
        else:
            divisor_dic[i] += 1
                
c = 1          
for v in divisor_dic.values():
    c *= (v+1)
    c %= 10**9+7

print(c)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7
d = {}
def prime_factorization(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            if d.get(i) is None:
                d[i] = 1
                n //= i
            while n % i == 0:
                n //= i
                d[i] += 1
        i += 1
    if n > 1:
        if d.get(n) is None:
            d[n] = 1
        else:
            d[n] += 1


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

    for i in range(1,N+1):
        prime_factorization(i)
    
    ans = 1
    for v in d.values():
        ans *= v + 1
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import functools

def prime_factor(n):
    res = {}
    i = 2
    while i * i <= n:
        while n % i == 0:
            res[i] = 1
            n //= i
        i+=1
    if n != 1:
        res[n] = 1
    return res.keys()
    
N = int(input())
target = functools.reduce(lambda a, b: a * b, range(1, N + 1))

factors = prime_factor(target)
total = 1
for f in factors:
    count = 1
    while target % f == 0:
        target //= f
        count += 1
    
    total *= count

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

Submission status: Accepted

Solution code:
from collections import Counter
div = 10**9 + 7

def pf(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 = int(input())
a = Counter()

for i in range(2,m+1):
    a += Counter(pf(i))

ans = 1
for i in range(1,1001):
    if a[i] == 0:
        continue
    else:
        ans = ans * (a[i] + 1) % div
        
print(ans)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

n = int(input())

S = [0] * (n+1)

for i in range(1, n+1):
    n_i = i
    p = 2 
    while n_i > 1:
        while n_i % p == 0:
            n_i //= p
            S[p] += 1
        p += 1

ans = 1
for s in S:
    ans *= s+1

print(ans % MOD)

Submission status: Accepted

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

    for i in range(1, n+1):
        n_i = i
        p = 2
        while n_i > 1:
            while n_i % p == 0:
                n_i //= p
                S[p] += 1
            p += 1

    ans = 1
    for s in S:
        ans *= s+1
    print(ans % MOD)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
table = [0]*(N+2)
def factorize2(n): # 素因数分解　2次元素数リスト([素数,指数])
    i = 2
    m = 1
    
    sign = -1
    while i * i <= n:
        j = 0
        while n % i == 0:
            n //= i
            j += 1
        if j != 0:
            table[i] += j
        if i >= 5:
            if sign < 0:
                sign = 1
                i = 6*m + sign
            else:
                m += 1
                sign = -1
                i = 6*m + sign
        elif i == 2:
            i += 1
        elif i == 3:
            i = 5
    if n > 1:
        table[n] += 1
    return table # list


for i in range(2,N+1):
    factorize2(i)
ans = 1
for i in range(len(table)):
    if table[i] > 0:
        ans *= table[i]+1
        ans %= 10**9+7

print(ans)