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

def divisor(N, div):
    if N==0 or N==1:
        return div
    n=N
    for i in range(2, int(N**0.5)+1):
        if n%i==0:
            cnt=0
            while n%i==0:
                cnt+=1
                n//=i
            try:
                div[i]+=cnt
            except:
                div[i]=cnt
    if n!=1:
        try:
            div[n]+=1
        except:
            div[n]=1
    return div

def fact(n):
    div={}
    for i in range(1, n+1):
        div=divisor(i, div)
    return div

d=fact(n)
mod=10**9+7
ans=1
for k,v in d.items():
    ans*=(v+1)
    ans%=mod
print(ans)

Submission status: Accepted

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

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

ans = 1
for div in d:
  ans = ans * (d[div] + 1) % m

print(ans)

Submission status: Accepted

Solution code:
mod = 1000000007

N = int(input())

dic = {}
for i in range(1,N+1):
  tmp = i
  k = 2
  while tmp != 1:
    if tmp%k == 0:
      if k in dic:
        dic[k] += 1
      else:
        dic[k] = 1
      tmp //= k
      k = 2
    else:
      k += 1

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

Submission status: Accepted

Solution code:

import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

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


def soinsu_bunkai(n):
	ans = []
	num = n
	i = 2
	while i <= n**0.5:
		if num % i == 0:
			if len(ans) == 0 or ans[-1][0] != i:
				ans.append([i, 1])
			else:
				ans[-1][1] += 1
			num = num//i
		else:
			i+=1
	if num != 1:
		ans.append([num, 1])

	return ans

N = int(input())

soinsu_list = defaultdict(int)
for i in range(2, N + 1):
	soinsu = soinsu_bunkai(i)
	for x in soinsu:
		soinsu_list[x[0]] += x[1]


ans = 1
for i in soinsu_list:
	ans *= soinsu_list[i] + 1
	ans = ans % 1000000007

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
P=[2]
for i in range(3,n+1,2):
  for j in range(3,int(i**0.5+1)):
    if i%j==0:
      break
  else:P.append(i)
p=[1]*len(P)
for i in range(1,n+1):
  for j in range(len(P)):
    x=i
    c=0
    while(x%P[j]==0):
      x//=P[j]
      c+=1
    p[j]+=c
a=1
for x in p:
  a*=x
print(a%(10**9+7))

Submission status: Accepted

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

# print(L)

for i in range(2, len(L)):
    if L[i] > 0:
        ans = (ans * (L[i]+1)) % mod
print(ans)

Submission status: Accepted

Solution code:
def prime_factor(n):#素因数分解
    factors = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            factors.append(i)
            n = n//i
    if n!=1:
        factors.append(n)
    return factors

N = int(input())
P = [0]*(N+1)
ans = 1
mod = 10**9+7
for i in range(2,N+1):
    a = prime_factor(i)#iについて素因数分解でリストが帰ってくる
    for j in a:
        P[j] += 1#各素数の数がカウントされる 10であれば2*5なのでp[1]とp[4]に加算される
for k in P:
    ans = ans*(k+1)%mod
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import collections

n = input()

# 階乗を計算する
N = math.factorial(int(n))

# 試し割り方で素因数分解を行う
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

a = prime_factorize(N)

# 素因数の値と個数を辞書型にする
c = collections.Counter(a)

# 個数だけをリストで取得
d = list(c.values())

# 個数+1の総積が約数の個数となる
e = 1
for i in range(len(d)):
    e = e*(d[i]+1)

# 求められていた値の出力
print(e % 1000000007)

Submission status: Accepted

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

def div(m):
  d = {}
  temp = int(math.sqrt(m))+1
  for i in range(2, temp):
    while m%i== 0:
      m //= i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
  if d == {}:
    d[m] = 1
  else:
    if m in d:
      d[m] += 1
    elif m != 1:
      d[m] =1
  return d

from collections import Counter

d = {}
for i in range(2, n+1):
  d = dict(Counter(d)+Counter(div(i)))
#print(d)
ans = 1
for i in d.values():
  ans *= (i+1)
  ans %= 10**9+7
print(ans)

Submission status: Accepted

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

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

    MOD = int(1e9) + 7

    MAX_PRIME = N
    primes = []
    is_prime = [True] * (MAX_PRIME+1)
    for i in range(2, MAX_PRIME+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_PRIME+1, i):
                is_prime[j] = False
    
    count = [0] * len(primes)
    for i in range(2, N+1):
        tmp = i
        for j in range(len(primes)):
            while tmp%primes[j] == 0:
                count[j] += 1
                tmp //= primes[j]
    
    ans = 1
    for c in count:
        if c > 0:
            ans *= c+1
            ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


MOD = 1000000007  # type: int

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


def solve(N: int):
    from functools import reduce
    from operator import mul

    nn = reduce(mul, range(1,N+1))
    from collections import defaultdict
    

    d = defaultdict(int)
    for i in range(2, N+1):
        t = prime_factorize(i)        

        for j in t:
            d[j] += 1

    ans = 1
    for i,v in d.items():
        if(i == 1): continue
        ans *= (v+1)

    print(ans%MOD)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

flg = [1 for _ in range(1001)]
flg[0] = 0
flg[1] = 0


def judge(n):
	tmp = math.floor(n**(1/2))
	for i in range(2,tmp+1):
		if n % i == 0:
			return False
	return True


for i in range(2,1001):
	if flg[i] == 0:
		continue

	if judge(i):
		for j in range(2, 1000//i + 1):
			flg[i*j] = 0

sosu = [i for i in range(1001) if flg[i] == 1]



cnt = [0 for _ in range(N+1)]

def SB(n):
	t = n
	i = 0
	while t != 1:
		tmp_cnt = 0
		while t % sosu[i] == 0:
			t //= sosu[i]
			tmp_cnt += 1
		cnt[sosu[i]] += tmp_cnt
		i += 1
		tmp_cnt = 0


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

ans_l = [cnt[i] for i in range(N+1) if cnt[i] != 0]

ans = 1
for i in range(len(ans_l)):
	ans *= (ans_l[i]+1)
	ans %= 1000000007

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math
import collections

N = int(input().split()[0])

def factorize(n: int) -> list:
    # 試し割り法
    f_list = []
    while n % 2 == 0:
        f_list.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            f_list.append(f)
            n //= f
        else:
            # 偶数はすでにチェックしているので+2ずつカウントアップ
            f += 2

    if n != 1:
        f_list.append(n)
    return f_list

mod = 10**9 + 7
c = 1
d_list = []
counter = collections.Counter()

for i in range(1, N+1):
    f_list = factorize(i)
    c = collections.Counter(f_list)
    counter += c

x = 1

for k, v in counter.items():
    x *= (v + 1) % mod

ans = x % mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10 ** 9 + 7 
f = 1
res = 1
for i in range(2, N + 1): f *= i
for i in range(2, N + 1):
  c = 0
  while f % i == 0:
    c += 1
    f //= i
  res *= (c + 1) % mod
  res %= mod
print(res % mod)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
#素因数分解
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 = inp()
x = 1
ans = 1
for i in range(1,n+1):
    x *= i
cnt = Counter(prime_factorize(x))
# print(cnt)
for value in cnt.values():
    ans *= (value+1)
print(ans%mod)

Submission status: Accepted

Solution code:
def soinsuu(n):
    ans = [0 for _ in range(n+1)]
    while n>1:
        for i in range(2,n+1):
            if n % i==0:
                ans[i] += 1
                n = n//i
                break
    return ans

N = int(input())

sosuu_cnt_list = [0 for _ in range(N+1)]
for i in range(1,N+1):
    tmp_sosuu_cnt = soinsuu(i)
    for sss,cnt in enumerate(tmp_sosuu_cnt):
        sosuu_cnt_list[sss] += cnt

cnt = 1
for sosuu_cnt in sosuu_cnt_list:
    if sosuu_cnt !=0:
        cnt *= sosuu_cnt+1
        cnt %= 10**9+7



print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
p = 1

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

for i in range(2, N + 1):
    if p % i != 0:
        continue
    c = 1
    while p % i == 0:
        p //= i
        c += 1
    ans *= c
print(ans % 1000000007)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import mul
from collections import Counter


def generate_primes(n):
    """Returns list of primes <= n."""
    from math import sqrt
    isprime = [True] * n
    isprime[0] = False
    for i in range(2, 1+round(sqrt(n))):
        if not isprime[i-1]:
            continue
        for j in range(2, 1 + n // i):
            isprime[i*j-1] = False
    p = [i+1 for i, v in enumerate(isprime) if v]
    return p


def fact_in_primes(n, primes):
    """primes must be sorted."""
    # assert 1 not in primes
    from collections import Counter
    c = Counter()
    for p in primes:
        if n < p:
            break
        while n % p == 0:
            n //= p
            c[p] += 1
    assert n == 1
    return c


N = int(input())
primes = generate_primes(N)
c = sum([fact_in_primes(n, primes) for n in range(2, N + 1)], Counter())
ans = reduce(mul, [n + 1 for n in c.values()], 1) % 1000000007
print(ans)

Submission status: Accepted

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

N=int(input())
A=[0]*1000
total=1
for i in range(1,N+1):
    for j in range(len(factorize(i))):
        A[factorize(i)[j]]+=1

for i in range(2,1000):
    if A[i]>=1:
        total*=(A[i]+1)

print(total%1000000007)

Submission status: Accepted

Solution code:
N=int(input())
l=[]
for i in range(2,N+1):
    for j in l:
        if i%j==0:
            break
    else:
        l.append(i)
a=1
for i in l:
    t=0
    s=1
    while i**s<=N:
        t+=N//i**s
        s+=1
    a=a*(t+1)%(10**9+7)
print(a)

Submission status: Accepted

Solution code:
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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


mod = 10 ** 9 + 7
d = [0] * (10 ** 3 + 1)
n = ni()
for i in range(1, n+1):
    for pn in prime_decomposition(i):
        d[pn] += 1
ans = 1
for i in range(1, len(d)):
    if d[i] != 0:
        ans *= (d[i] + 1)
        ans %= mod
print(ans)

Submission status: Accepted

Solution code:
import collections

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

li = {}

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

    c = collections.Counter(prime_factorize(i))
    keys = list(c.keys())
    values = list(c.values())
    for i in range(len(keys)):
        if keys[i] in li:
            li[keys[i]] += values[i]
        else:
            li[keys[i]] = values[i]

ans = list(li.values())
ans = [i+1 for i in ans]

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)
n = int(input())
def factrial(n):
    if n == 1:
        return 1
    return n * factrial(n-1)
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
prime = primes(n)
fact = factrial(n)
ans = []
for i in prime:
    tmp = 0
    for j in range(1, 1000):
        ij = i**j
        if tmp > n:
            break
        tmp += n//ij
    ans.append(tmp + 1)
answer = 1
for i in ans:
    answer *= i
print(answer%(10**9+7))

Submission status: Accepted

Solution code:
from collections import defaultdict
MOD = 10**9 + 7
n = int(input())

d = defaultdict(int)
for m in range(2, n+1):
    while m % 2 == 0:
        d[2] += 1
        m = m // 2

    p = 3
    while m > 1:
        while m % p == 0:
            d[p] += 1
            m = m // p
        p += 2

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
INF=10**9+7
Num=[0]*(n+1)
for x in range(2,n+1):
    i=2
    while i*2<=x:
        while x%i==0:
            x=x//i
            Num[i]+=1
        i=i+1
    if not x==1:
        Num[x]+=1
ans=1
for i in Num:
    ans=(ans*(i+1))%INF
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
div = {}
def dividers(n):
  global div
  i = 2
  while n != i:
    if n % i == 0:
      div[i] = div.setdefault(i, 0) + 1
      n //= i
      i = 2
    else:
      i += 1
  else:
    div[i] = div.setdefault(i, 0) + 1

for n in range(2, N + 1):
  dividers(n)

def f(L):
  ret = 1
  for l in L.values():
    ret *= (l + 1)
  return ret

print(f(div) % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
n = int(input())

mod = 10**9+7

sosu = [1] * 1001

for j in range(2,n+1):
    tmp = j
    i = 2
    while tmp > 1:
        if tmp % i == 0:
            sosu[i] += 1
            tmp = tmp // i
        else:
            i += 1
        
#print(sosu)
sosu.sort(reverse=True)

ans = 1

for i in range(len(sosu)):
    if sosu[i] > 1:
        ans = ans*sosu[i] % mod
        
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p_list=[2]
for i in range(3,1000):
  for p in p_list:
    if i%p==0:
      break
  else:
    p_list.append(i)

p_kosu=[0,0]
for i in range(1,10):
  p_kosu[0]+=n//(2**i)
  p_kosu[1]+=n//(3**i)
for p in p_list:
  if p==2 or p==3:
    continue
  if p>n:
    break
  kosu=n//p
  if p**2>n:
    p_kosu.append(kosu)
    continue
  kosu+=n//(p**2)
  if p**3>n:
    p_kosu.append(kosu)
    continue
  kosu+=n//(p**3)
  if p**4>n:
    p_kosu.append(kosu)
    continue
  kosu+=n//(p**4)
  p_kosu.append(kosu)
ans=1
for i in p_kosu:
  ans=ans*(i+1)%1000000007
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input().strip())

def make_prime_list(N):
  prime_list = [2,3]
  for i in range(5, N+1):
    flag = True
    for p in prime_list:
      if i % p == 0:
        flag = False
        break
    if flag:
      prime_list.append(i)
    
  return prime_list

prime_list = make_prime_list(N)
  
def prime_factorization(n, prime_list):
  result = []
  for p in prime_list:
    while True:
      if n % p == 0:
        result.append(p)
        n = n//p
      else:
        break
  return result
  
all_counter = Counter()
for i in range(2,N+1):
  all_counter += Counter(prime_factorization(i, prime_list))

ans = 1
for k in all_counter.keys():
  ans *= all_counter[k]+1
  
print(ans%1000000007)

Submission status: Accepted

Solution code:
import math
import collections
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if n == 1:
        return factor
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor

n = int(input())
kai = [0 for _ in range(n+1)]
MOD = 10**9 + 7
l = []

for i in range(1, n+1):
    l.extend(trial_division(i))
c = collections.Counter(l)

s = 1
for key, value in c.items():
    s *= (value + 1)
    s %= MOD

print(s)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

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

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

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

    return arr
dic = defaultdict(int)
x = 1
for n in range(1, N+1):
	for i in factorization(n):
		if i[0] == 1:
			continue
		dic[i[0]] += i[1]
for val in dic:
	x = (x * (dic[val]+1))%MOD

print(x)

Submission status: Accepted

Solution code:
import math
def main():
    N = int(input())
    div = pow(10, 9) + 7

    if N == 1: return 1
    primes = primes1000()
    d = dict()
    for i in range(2, N+1):
        j = i
        for p in primes:
            if p > j:
                break
            else:
                while j % p == 0:
                    j = j // p
                    d[p] = d.get(p, 0) + 1

    # print(d)
    ans = 1
    for p in d:
        ans *= (d[p] + 1)
    return ans % div


def primes1000():
    pms = []
    for i in range(2, 1000+1):
        isPrime = True
        for j in range(2, int(math.sqrt(i))+1):
            if i % j == 0:
                isPrime = False
                break
        if isPrime:
            pms.append(i)
    return pms



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

Submission status: Accepted

Solution code:
def pfn(N):
    factor=[]
    N=int(N)
    if N==1:
        return []
    else:
        for num in range(2, N+1):
            while N % num==0:
                N //=num
                factor.append(num)
        return factor
            
N=int(input())
factor=[]
for i in range(1, N+1):
    factor+=pfn(i)
    
p=1
factor_set=list(set(factor))
for x in factor_set:
    p*=factor.count(x)+1
    
print(p%(10**9+7))

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
from collections import defaultdict
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)


def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]


def search_divisor_num_of_factorial_num(num):
    if num <= 0:
        return 0
    elif num == 1:
        return 1
    elif num == 2:
        return 2
    else:
        # 素数とその個数を入れていく
        dict_counter = defaultdict(int)
        # メモ用のdict
        dict_memo = defaultdict(list)

        for a_num in range(2, num + 1):
            num_sqrt = math.ceil(math.sqrt(a_num))
            prime_list = make_prime_list_2(num_sqrt)

            # メモ用のdictに入れるためのkeyを残しておく
            now_num = a_num

            for prime in prime_list:
                while a_num % prime == 0:
                    # メモ内にある場合、そこから全部移して、移し終わったらループを抜ける
                    if a_num in dict_memo:
                        for memo in dict_memo[a_num]:
                            dict_counter[memo] += 1
                            dict_memo[now_num].append(memo)

                        a_num = 1

                    else:
                        dict_counter[prime] += 1
                        dict_memo[now_num].append(prime)
                        a_num //= prime

            if a_num != 1:
                dict_counter[a_num] += 1
                dict_memo[now_num].append(a_num)

        divisor_num = 1
        dict_fact = dict(dict_counter)
        for value in dict_fact.values():
            divisor_num *= (value + 1)

        return divisor_num
print(search_divisor_num_of_factorial_num(_I())%mod)

Submission status: Accepted

Solution code:
import math

N = int(input())

def prime(n):
    if n <=1:return []
    primes = [i for i in range(n+1)]
    primes[1] = 0
    for i in primes:
        if i == 0:continue
        if i > math.sqrt(n):break
        for j in range(2*i, n+1, i):primes[j]=0
            
    return [prime for prime in primes if prime!=0]

cnt =[0]*N

for i, j in enumerate(prime(N)):
    for k in range(2,N+1):
        while k%j==0:
            cnt[i]+=1
            k/=j

cnts =1
for l in cnt:
    if l>0:cnts*=l+1
      
print(cnts%(10**9+7))

Submission status: Accepted

Solution code:
#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

# 素因数分解
def primes(n):
    ps = []
    i = 2
    while i * i <= n:
        while n % i == 0:
            ps.append(i)
            n //= i
        i += 1
    if n > 1:
        ps.append(n)
    return ps


def main():
    n = int(input())
    pl = []
    for i in range(1,n+1):
        pl += primes(i)

    counter = Counter(pl)
    # print(counter)
    ans = 1
    for v in counter.values():
        ans *= (v + 1)
        ans %= 1000000007
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
x = 1
for i in range(2, N + 1):
  x *= i

count = 1
ans = 1
for i in range(2, N + 1):
  if x % i != 0:
    continue
  count = 1
  while x % i == 0:
    x //= i
    count += 1
  ans *= count
print(ans % MOD)

Submission status: Accepted

Solution code:
N = int(input())
ps = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 }
bs = []
for n in range(1, N+1):
  a = n
  while a > 1:
    prime = True
    for p in ps:
      if a%p == 0:
        prime = False
        bs.append(p)
        a = a//p
    if prime:
      bs.append(a)
      a = 1
#print(bs)
ps2 = set(bs)
r = 1
for p in ps2:
  c = bs.count(p)
  r = r*(c+1)%1000000007
print(r)

Submission status: Accepted

Solution code:
N = int(input())
es = [0] * 1001
ans = 1

def div(n):
    b = 2
    while b <= n:
        while n%b==0:
            n //= b
            es[b] += 1
        b += 1

for i in range(1,N+1):
    div(i)

for e in es:
    ans *= e + 1
    ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:

n = int(input())

histogram = [0] * (n + 1)
for i in range(2,n+1):
    x = i
    p = 2
    while x > 1:
        while x % p == 0:
            histogram[p] += 1
            x //= p
        p += 1
answer = 1
for a in filter(lambda x:x>0,histogram):
    answer = (answer * (a+1)) % (1e9+7)
print(int(answer))

Submission status: Accepted

Solution code:
p=[2];A=1000
for L in range(3,A):
    chk=True
    for L2 in p:
        if L%L2 == 0:chk=False
    if chk==True:p.append(L)
n = int(input())
ll = [[0]*len(p) for _ in [0]*(n+1)]
for i in range(1,n+1):
  for j in range(len(p)):
    ll[i][j] = ll[i-1][j]
    tmp = i
    while True:
      if tmp%p[j] == 0:
        ll[i][j] += 1
        tmp = tmp//p[j]
      else:
        break
ans = 1
for i in ll[-1]:
  ans*=(i+1)
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
from collections import defaultdict

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

primeCount = defaultdict(int)

def primeList(n):
    p = 2
    primeList = defaultdict(int)
    while n > 1:
        if n % p == 0:
            while n % p == 0:
                primeList[p] += 1
                n //= p
        p += 1
    if n >= 2:
        primeList[n] = 1
    return primeList

for i in range(1, N + 1):
    for prime, count in primeList(i).items():
        primeCount[prime] += count

ans = 1
for _, count in primeCount.items():
    ans *= (count + 1)
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

v = [2]
for i in range(3,n+1):
    sosu = True
    for j in v:
        if i%j == 0:
            sosu = False
    if sosu:
        v.append(i)


ans = 1
for j in v:
    count = 0
    for i in range(1,n+1):
        while i%j == 0:
            count += 1
            i= i//j
    ans = (ans * (count+1))%(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
ls = []
for i in range(2, n + 1):
    t = i
    for j in range(2, i + 1):
        while True:
            if t % j == 0:
                t //= j
                ls.append(j)
            else:
                break
ls = collections.Counter(ls)
cnt = 1
for i in ls.values():
    cnt *= ((i + 1) % (10 ** 9 + 7))
print(cnt % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
from collections import Counter

MOD = 10**9 + 7
N = int(input())
count = Counter()
ans = 1
num = []

for i in range(2, N+1):
    
    for n in num:
        while not i % n:
            count[n] += 1
            i //= n
        if i == 1:
            break
    else:
        num.append(i)
        count[i] = 1
        
for n in count.values():
    ans = ans * (n+1) % MOD
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
prime = [1 for _ in range(1000)]
for i in range(1,n+1):
  now = i
  div = 2
  while now > 1:
    if now % div == 0:
      now //= div
      prime[div-1] += 1
    else:
      div += 1
ans = 1
for i in range(n):
  ans *= prime[i]
  ans %= mod
print(ans)
#print(prime)

Submission status: Accepted

Solution code:

import collections
import itertools
import sys
import time

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

def get_primes(max_val):
    is_prime = [True] * (max_val + 1)
    for i in range(2, max_val+1):
        if not is_prime[i] or i * i > max_val:
            continue
        for j in range(i*i, max_val+1, i):
            is_prime[j] = False
    res = []
    for i in range(2, len(is_prime)):
        if is_prime[i]:
            res.append(i)
    return res

def get_prime_factor(n, primes):
    if n == 1:
        return (1, 1)
    res = []
    for p in primes:
        if p * p > n:
            break
        c = 0
        while not n % p:
            n //= p
            c += 1
        if c:
            res.append((p, c))
    if n != 1:
        res.append((n, 1))
    return res

primes = get_primes(1000000)

n=getint()
if n == 1:
    print("1")
    sys.exit(0)

factors = collections.defaultdict(int)
for i in range(2,n+1):
    tmp = get_prime_factor(i,primes)
    for p, c in tmp:
        factors[p] += c

res = 1
for p,c in factors.items():
    res *= c + 1
    res %= 10**9+7

print(res)

Submission status: Accepted

Solution code:
import math

def is_prime(n):
  if n == 1:
    return False

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

N = int(input())

pn_l = []
for i in range(2, N + 1):
  if is_prime(i):
    pn_l.append(i)

ans = 1
n_factorial = math.factorial(N)
for pn in reversed(pn_l):
  s = 0
  while n_factorial % pn == 0:
    s += 1
    n_factorial //= pn
  ans *= s + 1 
print(ans % (10**9+7))

Submission status: Accepted

Solution code:
N = int(input())
p = 1
for i in range(2, N + 1):
    p *= i
ans = 1
for i in range(2, N + 1):
    if p % i != 0:
        continue
    c = 1
    while p % i == 0:
        p //= i
        c += 1
    ans *= c
print(ans % 1000000007)

Submission status: Accepted

Solution code:
x = int(input())
p_list = {}


def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

for i in range(1,x+1):
    for k in prime_factors(i):
        p_list[k] = p_list.get(k, 0) + 1

# del p_list[1]

divn = 1e9+7
ans = 1
for k in p_list.keys():
    ans *= p_list[k] + 1
    ans = ans % divn

print(int(ans))