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())
div_map = dict()
mod = 10 ** 9 + 7

for i in range(1, n + 1):
    is_prime_number = True
    for j in range(2, int(i ** (1 / 2)) + 1):
        if i % j == 0:
            is_prime_number = False
            break
    if is_prime_number:
        if i not in div_map:
            div_map[i] = 1
        else:
            div_map[i] += 1
    else:
        j = 2
        while i != 1:
            if i % j == 0:
                if j not in div_map:
                    div_map[j] = 1
                else:
                    div_map[j] += 1
                i //= j
            else:
                j += 1


res = 1
div_map[1] = 0
for key, value in div_map.items():
    res = res * (value + 1) % mod

print(res % mod)

Submission status: Accepted

Solution code:
from collections import Counter
def f(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())
if n == 1:
    print(1)
    exit()
d = {}
mod = 10**9+7
d[2] = 1
for i in range(3, n+1):
    x = f(i)
    c = Counter(x)
    for j in c.keys():
        if j not in d:
            d[j] = c[j]
        else:
            d[j] += c[j]
        d[j] = d[j] % mod
ans = 1
for i in d.keys():
    ans *= d[i]+1
print(ans%mod)

Submission status: Accepted

Solution code:
def prime_fact(N):
  M = N
  primes = []
  K = 2

  while K*K <= M:
    while N%K == 0:
      primes.append(K)
      N = N//K
    K += 1
  
  if N != 1:
    primes.append(N)

  return primes

N = int(input())
nums = [0]*1000
ans = 1

for i in range(2,N+1):
  P = prime_fact(i)
  for j in range(len(P)):
    nums[P[j]-1] += 1

for k in range(1000):
  ans = ans*(nums[k]+1)%1000000007

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

t = [0] * (n+1)
for j in range(2, n+1):
  y = j
  for i in range(2, n+1):
    while y % i == 0:
      t[i] += 1
      y = y//i
ans = 1
p = 10**9 + 7
for i in t:
  if i != 0:
    ans *= (i+1)
    ans %= p
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
if __name__ == '__main__':
    N = int(input())
    map = dict()
    for n in range(N, 1, -1):
        F = factorization(n)
        for f in F:
            p = f[0]
            e = f[1]
            if f[0] in map:
                map[p] += e
            else:
                map[p] = 0
                map[p] += e
    ans = 1    
    for m in map.values():
        ans *= (m + 1)
    print(ans%(pow(10, 9)+7))

Submission status: Accepted

Solution code:
n = int(input())
is_prime = [True] * 1005
MOD = 10 ** 9 + 7
is_prime[0] = is_prime[1] = False
factors = []
for i in range(2, n + 1):
    if is_prime[i]:
        cnt = 0
        for j in range(i * i, n + 1, i):
            is_prime[j] = False
        i_init = i
        while i <= n:
            cnt += n // i
            i *= i_init
        factors.append(cnt)
ans = 1
for x in factors:
    ans = ans * (x + 1) % MOD
print(ans)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    N = i_input()
    N = math.factorial(N)

    def prime_decomposition(n):
        i = 2
        table = []
        while i * i <= n: # sqrt(n)で計算が済む
            while n % i == 0:
                n //= i
                table.append(i)
            i += 1
        if n > 1:
            table.append(n)
        return table

    N = sorted(prime_decomposition(N))
    ans = 1
    for i,k in itertools.groupby(N):
        ans *= len(list(k)) + 1
    print(ans%MOD)



if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = 1
ans = 1
for i in range(1, n+1):
  s *= i
for i in range(2, n+1):
  k = 1
  while s % i == 0:
    s = s // i
    k += 1
  ans *= k
print(ans % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
def erat(n):
    n+=1
    l=[1 for _ in range(n)]
    l[0],l[1]=0,0
    for i in range(4,n,2):
        l[i]=0
    for i in range(9,n,6):
        l[i]=0
    for i in range(6,n,6):
        if l[i-1]:
            for j in range((i-1)*(i-1),n,i-1):
                l[j]=0
        if l[i+1]:
            for j in range((i+1)*(i+1),n,i+1):
                l[j]=0
    return l
prime=[]
for i in range(1001):
    if erat(1000)[i]:
        prime.append(i)
n=int(input())
u=[0]*1001
for i in range(1,n+1):
    for j in prime:
        while i%j==0:
            i//=j
            u[j]+=1
ans=1
for i in u:
    ans*=i+1
print(ans%(10**9+7))

Submission status: Accepted

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

x=[-1]*(n+1) #2以上の自然数に対して最小の素因数を表す
x[0]=0
x[1]=1
i=2
prime=[]
while i<=n:
    if x[i]==-1:
        x[i]=i
        prime.append(i)
    for j in prime:
        if i*j>n or j>x[i]:break
        x[j*i]=j
    i+=1

d=[0]*(n+1)
for i in range(1,n+1):
    while x[i]!=1:
        p=x[i]
        d[p]+=1
        i=i//p

ans=1

for i in range(n+1):
    ans=ans*(d[i]+1)%q
print(ans%q)

Submission status: Accepted

Solution code:
n=int(input())
x=[0]*(n+1)
a=2
q=10**9+7
if n==1:
    print(1)
    exit()

for i in range(2,n+1):
    a=i
    p=2
    while p*p<=i:
        if a%p==0:
            x[p]+=1
            a=a//p
        else:
            p+=1
    if a!=1:
        x[a]+=1

ans=1
for i in range(n+1):
    ans=ans*(x[i]+1)%q
print(ans%q)

Submission status: Accepted

Solution code:
N=int(input())
table=[True for _ in range(N+1)]
table[0]=False
table[1]=False
for i in range(2,N+1):
    if table[i]==False:
        continue
    for j in range(2,N//i):
        table[i*j]=False
p=[]
for i in range(N+1):
    if table[i]:
        p.append(i)

n=len(p)
cnt=[0 for _ in range(n)]
for i in range(2,N+1):
    x=i
    j=0
    while x>1:
        while x%p[j]==0:
            cnt[j]+=1
            x//=p[j]
        j+=1
ans=1
MOD=1000000007
for i in range(n):
    ans*=cnt[i]+1
    ans%=MOD
print(ans)

Submission status: Accepted

Solution code:
MOD = 10**9+7
memo = [0]*10000

N = int(input())

def primeLst(k):
  acc = []
  if k == 1:
    return acc
  f = 2
  while f * f <= k:
    if k % f == 0:
      acc.append(f)
      k //= f
    else:
      f += 1
  if k != 1:
    acc.append(k)
  return acc

for i in range(N):
  l = primeLst(i+1)
  for x in l:
    memo[x] += 1

res = 1
for i in range(1,N):
  res *= memo[i+1] + 1
  res %= MOD

print(res)

Submission status: Accepted

Solution code:
from collections import Counter
N=int(input())
mod=1000000000 + 7

#nを素因数分解したリストを返す
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


prime_table=[]
for i in range(2, N+1):
  prime_table+=(prime_decomposition(i))

prime_table=Counter(prime_table)
ans=1
for k, v in prime_table.items():
  ans*=(v+1)%mod

print(ans%mod)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7


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


L = primes(N)

ans = [0] * (N + 1)
for i in range(2, N + 1):
    for j in L:
        if i < j:
            break
        while True:
            if i % j == 0:
                i //= j
                ans[j] += 1
            else:
                break

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

Submission status: Accepted

Solution code:
prime = [False] * 1001

for i in range(2,1001):
	if prime[i] == False:
		for j in range(i*i,1001,i):
			prime[j]=True

n = int(input())

cnt = [0] * 1001
for i in range(2,n+1):
	for j in range(2,n+1):
		if prime[j] == False:
			val = i
			while val%j==0:
				cnt[j]+=1
				val/=j

ans=1

for x in cnt:
	ans*=(x+1)
	ans%=1000000007

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
from collections import defaultdict
arr = defaultdict(int)
for i in range(2,N+1):
    temp = i
    f = True
    for j in range(2, int(-(-i**0.5//1))+1):
        if temp%j==0:
            cnt=0
            while temp%j==0:
                cnt+=1
                temp //= j
            f = False
            arr[j] += cnt
    if temp!=1:
        f = False
        arr[temp] += 1
    if f:
        arr[i] += 1
ans = 1
for i in arr.values():
    ans *= i+1
    ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
mod = 1000000007
x = [1 for _ in range(1001)]
Sum = 1

for i in range(1, N + 1):
    z = i
    for j in range(2, int(math.sqrt(N)) + 1):
        while z % j == 0:
            x[j] += 1
            z = int(z / j)
    if z != 1:
        x[z] += 1

for i in x:
    Sum *= i
    Sum %= mod

print(Sum)

Submission status: Accepted

Solution code:
import math

n = int(input())
if n == 1:
    print(1)
    exit(0)
dp = [0] * (n+1)
mod = 10**9+7

def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):

        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial): 
            input_list[s] = False

prime = sieve_of_erastosthenes(1000)
prime = [i for i, t in enumerate(prime) if t]

for i in range(2, n+1):
    v = i
    while v < n+1:
        dp[i] += 1
        v += i

dp2 = [0] * (n+1)
for p in prime:
    v = p
    k = 1
    while v < n+1:
        dp2[p] += dp[v]
        v *= p
        k += 1

ans = 1
for i in range(n+1):
    ans = (ans * (dp2[i]+1)) % mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [0 for i in range(1001)]
mod = 10 ** 9 + 7
for n in range(2, N+1):
  m = n
  k = 2
  while m > 1:
    while m % k == 0:
      m //= k
      A[k] += 1
    k += 1
ans = 1
for i in range(1, 1001):
  ans = ans * (A[i] + 1) % mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
counter = [0]*(n+1)
for i in range(2, n+1):
    num = i
    j = 2
    while j*j <= num:
        cnt = 0
        while num%j == 0:
            counter[j] += 1
            num //= j
        j += 1
    if num != 1:
        counter[num] += 1
ans = 1
for i in range(n+1):
    if counter[i] > 0:
        ans *= counter[i] + 1
        ans %= int(1e9+7)
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
c = [0 for _ in range(a)]
for i in range(1, a + 1):
    d = i
    for e in b:
        while d % e == 0:
            c[e - 1] += 1
            d //= e
    if d != 1:
        c[d - 1] += 1
f = 1
g = 10 ** 9 + 7
for h in c:
    f *= (h + 1)
    f %= g
print(f)

Submission status: Accepted

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

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

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

    return arr


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

lst=[0]*1000

for i in range(2,n+1):
  x=factorization(i)
  for j in x:
    lst[j[0]]+=j[1]
    
ans=1

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

Submission status: Accepted

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

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

is_prime = [True for _ in range(1100)]
is_prime[0] = is_prime[1] = False
for i in range(2, 1100):
    if not is_prime[i]: continue
    for j in range(i*i, 1100, i): 
        is_prime[j] = False

ind = []

for p in range(2, 1100):
    if is_prime[p]:
        cnt = 0 
        for m in range(2, n+1):
            while m%p == 0:
                m //= p
                cnt += 1
        if cnt != 0:
            ind.append(cnt)

#print('ind =', ind)
ans = 1 
for i in range(len(ind)):
    ans *= (ind[i]+1)

print(ans%mod)

Submission status: Accepted

Solution code:
N=int(input())
l=[0]*1000
def divisor_enu(N):
   l=[]
   for i in range(2,int(N**0.5)+1):
      cnt=0
      if N%i==0:
         while N%i==0:
            cnt+=1
            N//=i
         l.append((i,cnt))
   if N != 1:
      l.append((N,1))
   return l
for i in range(1,N+1):
   s=divisor_enu(i)
   for j in s:
      l[j[0]]+=j[1]
ans=1
mod=10**9+7
for i in l:
   if 0<i:
      ans=ans*(i+1)%mod
print(ans)

Submission status: Accepted

Solution code:
# 高速素因数分解
# """2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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

count=[0]*(n+1)
for i in range(1,n+1):
    if i==1:
        pass
    else:
        soinsuu_list=factorization(i)
        for soinsu,jisu in soinsuu_list:
            count[soinsu]+=jisu
ans=1
mod=10**9+7
for i in count:
    ans*=(i+1)
    ans=ans%mod
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())

prime_counts = defaultdict(int)

for i in range(2, N + 1):
    n = i
    for p in prime_counts:
        while True:
            if n % p == 0:
                prime_counts[p] += 1
                n = n // p
            else:
                break
    if n > 1:
        prime_counts[n] += 1

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

Submission status: Accepted

Solution code:
N=int(input())

factors = {num: 0 for num in range(2, N+1)}

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

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

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

    return factors

for num in range(2, N+1):
    factors = factorization(num, factors)
    
ans = 1
MOD = 10**9+7
for num in range(2, N+1):
    ans *= (factors[num] + 1) % MOD
    ans %= MOD
print(ans % MOD)

Submission status: Accepted

Solution code:
N = int(input())
mod = 1000000007
from collections import Counter
Y = Counter()
for i in range(2, N+1):
    M = i
    for j in range(2,i+1):
        while M % j == 0:
            Y[j] += 1
            M //= j

def product(X):
    res = 1
    for x in X:
        res *= x + 1
        res %= mod
    return res    

ans = product(Y.values())
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mod = 1000000007
from collections import defaultdict as dd
Y = dd(lambda:1)
for i in range(2, N+1):
    M = i
    for j in range(2,i+1):
        while M % j == 0:
            Y[j] += 1
            M //= j

def product(X):
    res = 1
    for x in X:
        res *= x
        res %= mod
    return res    

ans = product(Y.values())
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

MOD = 10 ** 9 + 7

def factorize(n):
    """ Simple factorize
    :param n: number to factorize
    :return: list of factors
       time complexity : O(n√n)
       space complexity : O(n)
    """
    factors = []
    for i in range(2, n+1):
        while n % i == 0:
            n = n // i
            factors.append(i)
    return factors

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

    factors = []
    for i in range(1, N+1):
        factors += factorize(i)
    factor_counts = list(Counter(factors).values())

    ans = 1
    for v in factor_counts:
        ans = ans * (v+1) % MOD

    print(ans)

main()

Submission status: Accepted

Solution code:
from sys import stdin

N= int(stdin.readline().rstrip())
values = list(range(1,N+1))

c = 1000000007

count = dict()
for i, v in enumerate(values):
  if v > 1:
    count[v] = count.get(v, 0) + 1
    for j in range(i+1, N):
      if (values[j] % v == 0):
          values[j] /= v
          count[v] += 1

result = 1
for v in count.values():
  result = (result * (v + 1)) % c
print(result)

Submission status: Accepted

Solution code:
from collections import Counter

def factor(n):
    Ret = []
    for i in range(2, n + 1):
        while n % i == 0:
            n = n // i
            Ret.append(i)
    if len(Ret) == 0:
        return [n, ]
    else:
        return Ret

n = int(input())
fact = []

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

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

Submission status: Accepted

Solution code:
x = int(input())
a = []
def cont(y):
    n = 0
    while True:
          if n - int(y ** (1/2)) + 1 == 0:
               a.append(y)
               break
                
          for j in range(2,int(y ** (1/2)) + 1):
                 if y % j == 0:
                    y = y // j
                    a.append(j)
                    n = 0
                    break
                 else:
                    n = n + 1

ans = 1
for k in range(2, x + 1):
    cont(k)
for h in range(2, x + 1):
    ans = ans * (a.count(h) + 1)

print(ans % 1000000007)

Submission status: Accepted

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

N=int(input())
total=1
ans=1
inf=10**9+7
total=[0]*1000
for i in range(1,N+1):
    temp=prime_factorize(i)
    for j in range(len(temp)):
        total[temp[j]-1]+=1


for i in range(1000):
    ans*=total[i]+1
    ans%=inf
print(ans)

Submission status: Accepted

Solution code:
import math
url = "https://atcoder.jp//contests/abc052/tasks/arc067_a"


def get_list_eratosthenes(n):
    if n < 2:
        return [0]*(n+1)
    prime = [1]*(n+1)
    prime[0] = prime[1] = 0
    for i in range(2, int(n**0.5) + 1):
        if not prime[i]: continue
        for j in range(i * 2, n + 1, i):
            prime[j] = 0
    return prime


def main():
    N = int(input())
    tmp = N
    primes = get_list_eratosthenes(N)
    ans = 1
    for p in range(2, N+1):
        if primes[p] == 0: continue
        cur = p
        num = 0
        while cur <= N:
            num += N // cur
            cur *= p
        ans *= (num + 1)
        ans %= 10**9+7
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

def nCr(n,r):
  N = 1
  R = 1
  for m in range(n-r,n+1):
    N *= m
    
  for m in range(2,r+1):
    R *= m
    
  return N//R
    

n = int(input())
primes = [p for p in primes if p <= n]
numpow = []
for p in primes:
  i = 1
  tmp = 0
  divisor = p
  while divisor <= n:
    tmp += (n // divisor)
    i += 1
    divisor = p**i
  numpow.append(tmp)

import math    
numpow = [i+1 for i in numpow]
y = math.prod(numpow)
print(y % (10**9+7))

Submission status: Accepted

Solution code:
import math
MOD=10**9+7
N=int(input())
ans=1
prime=set()
prime.add(2)
numofdiv=[0]*(N+2)
for h in range(2,N+1):
    flag=1
    for j in prime:
        if h%j==0:
            flag=0
            break
    if flag==1:
        prime.add(h)

for i in range(2,N+1):
    for p in prime:
        while(i%p==0):
            numofdiv[p]+=1
            i//=p
#print(numofdiv)
for q in range(N+2):
    ans*=numofdiv[q]+1
    ans%=MOD
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())
ls = [0]+[0]*N
couterls = collections.Counter(ls)
for i in range(1,N+1):
    for j in range(2,N+1):
        if i % j == 0:
            while i % j == 0:
                couterls[j] += 1
                i = i // j
        elif i == 1:
            break
        else:
            pass
ans = 1
couterls.pop(0)
for i in couterls.values():
    ans = (ans * (i+1) ) % (10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7


def get_sieve_of_eratosthenes(n):
    """
    エラトステネスの篩。√N以下の数に対して2から順にその数の倍数を消していく。
    計算量は「調和級数」になるのがミソ。具体的には
        N/2 + N/3 + N/5 + ... + N/(√N) = N * (1/2 + 1/3 + 1/5 + ... + 1/√N)
                                       = N * loglog(√N) (素数の逆数和の発散スピードがこれ)
                                       = N(loglogN - log2)
    """
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        return [0] * (n + 1)
    prime = [1] * (n + 1)
    prime[0] = prime[1] = 0
    for i in range(2, int(n**0.5) + 1):
        if not prime[i]: continue
        for j in range(i * 2, n + 1, i):
            prime[j] = 0
    return prime


def main():
    n = int(input())
    primes = get_sieve_of_eratosthenes(n)
    ans = 1
    for p in range(2, n + 1):
        if primes[p] == 0: continue
        cur = p
        num = 0
        while cur <= n:
            num += n // cur
            cur *= p
        ans *= (num + 1)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

primes = [0]*(n+1)

def factorize(n):
  
  global primes
  arr = []
  temp = n

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

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

for i in range(2, n+1):
  factorize(i)
  
MOD = 1000000007

def mod(n):         
  return n % MOD

def multiply(a, b): #mod(a*b)を求める
  return mod(mod(a)*mod(b))

ans = 1
for i in range(n+1):
  if primes[i] > 0:
    ans = multiply(ans, primes[i]+1)
    
print(mod(ans))

Submission status: Accepted

Solution code:
mod = 1000000000 + 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())
dat = [0] * 2000 # 約数として求められたある数の合計

# N! の各要素の素因数分解をする
res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]

for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod

print(res)

Submission status: Accepted

Solution code:
import collections
n = int(raw_input())
mod = ( 10 ** 9 ) + 7
def f(u):
	cu = collections.Counter()
	cur = 2
	while(u != 1):
		if u % cur == 0:
			while(u % cur == 0):
				cc[cur] +=1
				u/= cur
		cur +=1
	return cu
cc = collections.Counter()
for u in range(2, n + 1):
	for k,v in f(u).iteritems(): cc[k]+=cu[k]
ans = 1
for k in cc:
	ans *= (cc[k] + 1) 
	ans %= mod
print ans

Submission status: Accepted

Solution code:
import collections
n = int(raw_input())
mod = ( 10 ** 9 ) + 7
def f(u):
	cu = collections.Counter()
	cur = 2
	while(u != 1):
		if u % cur == 0:
			while(u % cur == 0):
				cc[cur] +=1
				u/= cur
		cur +=1
	return cu
cc = collections.Counter()
for u in range(2, n + 1):
	cu = f(u)
	for k in cu: cc[k]+=cu[k]
ans = 1
for k in cc:
	ans *= (cc[k] + 1) 
	ans %= mod
print ans

Submission status: Accepted

Solution code:
n=int(input())

sosuu = [2]
A = 1000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
    for L2 in sosuu:
        if L % L2 == 0:
            break # 素数でないことがわかったらそれ以上ループする必要はない
    else: # break で抜けることがなかったら L は素数（Python 特有の制御構文）
        sosuu.append(L)
ans=[]

for i in sosuu:
  ch=1
  x=i
  while x<=n:
    ch+=n//x
    x=x*i
    
  ans.append(ch)

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

Submission status: Accepted

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

if n == 1:
    print(1)
    exit()
if n == 2:
    print(2)
    exit()

prime = [2]
for i in range(3, n+1):
    j = 0
    flag = True
    while prime[j] * prime[j] <= i:
        if i % prime[j] == 0:
            flag = False
            break
        j += 1
    if flag:
        prime.append(i)

ans = 1
for p in prime:
    num = 1
    i = p
    while i <= n:
        num += n // i
        i *= p
    ans *= num
    ans %= mod

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
d={i:0 for i in range(2,n+1)}
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):
    for j in prime_factorize(i):
        d[j]+=1
a=1
for v in d.values():
    a=a*(v+1)
print(a%(10**9+7))

Submission status: Accepted

Solution code:
def PrimeDecomp(N,ConcFlag):
    if ConcFlag:
        if N<=1:
            return [1],1
        else:
            I = 2
            PrimeDec = []
            DivCount = 1
            while I*I<=N:
                Cnt = 0
                while N%I==0:
                    N //= I
                    PrimeDec.append(I)
                DivCount *= (Cnt+1)
                I += 1
            if N>=2:
                PrimeDec.append(N)
                DivCount *= 2
            return PrimeDec,DivCount        
    else:
        if N<=1:
            return [1],[1],1
        else:
            I = 2
            PrimeDec = []
            PrimeCnt = []
            DivCount = 1
            while I*I<=N:
                Cnt = 0
                while N%I==0:
                    N //= I
                    Cnt += 1
                if Cnt>=1:
                    PrimeDec.append(I)
                    PrimeCnt.append(Cnt)
                    DivCount *= (Cnt+1)
                I += 1
            if N>=2:
                PrimeDec.append(N)
                PrimeCnt.append(1)
                DivCount *= 2
            return PrimeDec,PrimeCnt,DivCount

def DivisorFactorial(N,FactDec,FactCnt,MemoFlag,Mod,ModFlag):
    if MemoFlag:
        if N<=1:
            FDivCnt = 1
            return FactDec,FactCnt,FDivCnt
        else:
            PrimeDec,PrimeCnt,_ = PrimeDecomp(N,False)
            for TP in range(0,len(PrimeDec)):
                if PrimeDec[TP] in set(FactDec):
                    FactCnt[FactDec.index(PrimeDec[TP])] += PrimeCnt[TP]
                else:
                    FactDec.append(PrimeDec[TP])
                    FactCnt.append(PrimeCnt[TP])
            FDivCnt = 1
            for TF in FactCnt:
                FDivCnt = [FDivCnt*(TF+1),(FDivCnt*(TF+1))%Mod][ModFlag]
            return FactDec,FactCnt,FDivCnt
    else:
        if N<=1:
            FDivCnt = 1
            return FactDec,FactCnt,FDivCnt
        else:
            for TN in range(2,N+1): 
                PrimeDec,PrimeCnt,_ = PrimeDecomp(TN,False)
                for TP in range(0,len(PrimeDec)):
                    if PrimeDec[TP] in set(FactDec):
                        FactCnt[FactDec.index(PrimeDec[TP])] += PrimeCnt[TP]
                    else:
                        FactDec.append(PrimeDec[TP])
                        FactCnt.append(PrimeCnt[TP])
            FDivCnt = 1
            for TF in FactCnt:
                FDivCnt = [FDivCnt*(TF+1),(FDivCnt*(TF+1))%Mod][ModFlag]
            return FactDec,FactCnt,FDivCnt
FactDec,FactCnt,FDivCnt = DivisorFactorial(int(input()),[],[],False,10**9+7,True)
print(FDivCnt)