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:
#ABC052C
N=int(input())
c={}
for i in range(1,N+1):
	t=0
	for k in range(2,i+1):
		t=0
		if i%k==0:
			while i%k==0:
				i//=k
				t+=1
			c[k]=c.get(k,0)+t
ans=1
for k in c.keys():
	ans*=(c[k]+1)
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys

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

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

dic = defaultdict(int)

for i in range(2, N+1):
    for j in range(2, i+1):
        num = 0
        while i%j == 0:
            num += 1
            i = i//j
        if num != 0:
            dic[j] += num

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

Submission status: Accepted

Solution code:
from collections import defaultdict
import math

n = math.factorial(int(input()))
i = 2
f = defaultdict(int)
a = 1
while i ** 2 <= n:
    while n%i==0:
        n //= i
        f[i] += 1
    i += 1
if n > 1:
    f[n] += 1
for n,m in f.items():
    a = (a*(m+1)) % (10**9+7)
print(a)

Submission status: Accepted

Solution code:
M = 1000000007

def main():
    n = int(input())
    print(solve(n))

def solve(n):
    d = dict()
    for i in range(2, n + 1):
        for f, c in factors(i):
            d[f] = d.get(f, 0) + c
    
    r = 1
    for c in d.values():
        r = (r * (c + 1)) % M
    
    return r

def factors(n):
    i = 2
    
    while i * i <= n:
        c = 0
        while n % i == 0:
            c += 1
            n //= i
        if c != 0:
            yield (i, c)
        
        i += 1
    
    if n != 1:
        yield (n, 1)

main()

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


def calculate(a):
    s = 0
    for i in range(len(a)):
        for k in range(i+1,len(a)):
            s+=(a[i]*a[k])
    return s

n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
#n,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#s = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
if n == 1:
    print(1)
elif n==2:
    print(2)
else:
    l = [0]* ( n + 1 )

    for i in range(n+1):
        s = []
        value = i
        search = 1
        while value != 1 and search <= math.sqrt(value):
            search+=1
            if value%search == 0:
                s.append(search)
                value = value//search
                search = 1
        if search > math.sqrt(value) and value > 1:
            s.append(value)

        for p in range(len(s)):
            l[s[p]]+=1
    ans = 1
    for i in range(2,n+1):
        if l[i]:ans*=(l[i]+1)
    print(ans%(pow(10,9)+7))

Submission status: Accepted

Solution code:
N=int(input())
soinsu=[]
ans = 1

if N==1:
    print(1)
    exit()

for i in range(2,N+1):
    num_tmp = i
    for j in range(2,i+1):
        while num_tmp%j==0 and num_tmp!=1:
            num_tmp /= j
            soinsu.append(j)

for i in range(2,N+1):
    cnt_tmp = soinsu.count(i)
    if cnt_tmp>0:
        ans *= cnt_tmp+1

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

Submission status: Accepted

Solution code:
import math
from collections import Counter

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

if __name__ == "__main__":
    N = int(input())
    num = math.factorial(N)
    pf = prime_factors(num)
    c = Counter(pf)
    
    res = 1

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

Submission status: Accepted

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

def nprf(n):
    E = [0] * (n + 1)
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                E[j] += 1
                i //= j
    return E

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
def factor(n):
    i = 2
    m = n
    while m >= i:
        while m%i == 0:
            m //= i
            d[i] += 1
            d[i] %= mod
            if m < i:break
        i += 1
n = I()
d = defaultdict(int)
for i in range(2,n+1):
    factor(i)
ans = 1
for i in d.values():
    ans *= i+1
    ans %= mod
print(ans)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
n=int(input())
from collections import defaultdict
data=defaultdict(int)
ans=1
mod=10**9+7
for i in range(1,1+n):
    target=i
    now=1
    while target>1:
        now+=1
        while target>1:
            if target%now==0:
                data[now]+=1
                target//=now
            elif target%now!=0:
                break
for x in data.keys():
    ans=(ans*(data[x]+1))%mod
print(ans)

Submission status: Accepted

Solution code:
import math 
insu=[[0]*1001 for i in range(1001)]
for i in range(1, 1001):
    n=i
    for j in range(2, 1001):
        while n%j==0:
            n=n//j
            insu[i][j]+=1
n=int(input())
new=[1]*1001
for i in range(1,n+1):
    for j in range(1001):
        new[j]+=insu[i][j]
ans=1
for n in new:
    ans*=n
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
import numpy as np
from collections import Counter


def calc_prime_factors(n):
    # https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
    """ Returns a array of primes, p < n """
    # assert n >= 2
    sieve = np.ones(n // 2, dtype=np.bool)
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i // 2]:
            sieve[i * i // 2::i] = False
    return np.r_[2, 2 * np.nonzero(sieve)[0][1::] + 1]


n = int(input())
primes_smaller_than_1000 = [x for x in calc_prime_factors(1000)]
primes = []
for num in range(1, n + 1):
    for prime_number in primes_smaller_than_1000:
        while num % prime_number == 0:
            num /= prime_number
            primes.append(prime_number)
counter_primes = Counter(primes)
res = 1
for i in counter_primes.values():
    res *= (i + 1)
    res %= 1000000007
print(res)

Submission status: Accepted

Solution code:
n = int(input())
mod = 1000000007
fact = [i+1 for i in range(1,n)]
ans = []
exp = 0
for base in range(2,n+1):
  exp = 0
  for i,num in enumerate(fact):
    while True:
      if num % base == 0:
        num = num // base
        exp += 1
      else:
        fact[i] = num
        break
  if exp>0:
    ans.append([base,exp])

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

print(ans_ans)

Submission status: Accepted

Solution code:
import bisect
N=int(input())
M=10**9+7
ans=1
prime=[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]
k=bisect.bisect(prime,N)
for i in range(k-1,-1,-1):
  x=0
  j=1
  while N//(prime[i]**j)>0:
    x+=N//(prime[i]**j)
    j+=1
  ans*=x+1
  ans%=M
print(ans)

Submission status: Accepted

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

# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

nd = {i:0 for i in range(n+1)}
for i in range(1, n+1):
    for j in prime_factor(i):
        nd[j] += 1
ans = 1
for i in nd.values():
    if i != 0:
        ans *= (i + 1)
        ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
prime = [2]
for i in range(3,N+1):
  if(all(i%p for p in prime)):
    prime.append(i)

ans = 1
for p in prime:
  tmp = N
  cnt = 0
  while tmp != 0:
    cnt += tmp//p
    tmp //= p
  ans = ans*(cnt+1) % mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
r = [0 for i in range(N+1)]
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

for i in range(2, N+1):
    L = prime_decomposition(i)
    for j  in range(len(L)):
        r[L[j]] += 1
        
count = 1      
for a in r:
    if a != 0:
        count *= a+1
        count = count%(10**9+7)
        
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
'''Snippets for factorization.
Available functions:
- run_prime_factorization: Run prime factorization.
'''


def run_prime_factorization(max_number: int) -> dict:
    '''Run prime factorization.
    Args:
        max_number: Int of number (greater than 1).
    Returns:
        A dictionary's items ((base, exponent) pairs).
    Landau notation: O(log n)
    '''

    from math import sqrt

    ans = dict()
    remain = max_number

    for base in range(2, int(sqrt(max_number)) + 1):
        if remain % base == 0:
            exponent_count = 0

            while remain % base == 0:
                exponent_count += 1
                remain //= base

            ans[base] = exponent_count

    if remain != 1:
        ans[remain] = 1

    return ans


def main():
    n = int(input())
    mod = 10 ** 9 + 7
    ans = 1
    d = dict()

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

        for fi in f.keys():
            if fi not in d.keys():
                d[fi] = 1
            else:
                d[fi] += f[fi]

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict
MOD = 10 ** 9 + 7

n = int(input())

prime_cnt = defaultdict(int)
for num in range(2, n + 1):
    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        prime_cnt[num] += 1

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def prime_factor(n):
    table = [0 for i in range(1000)]
    
    for x in range(2, N+1):
        for i in range(2, x+1):
            if i * i > x:
                break
            while x%i == 0:
                table[i] += 1
                x = x // i

        if x > 1:
            table[x] += 1
    return table
    
count = 1
    
res = prime_factor(N)

for r in res:
    count *= (r + 1)
    count %= 10**9+7
    
print(count)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

import math


class Prime:
    seed_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]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

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

    def is_prime_miller_rabin(self, n):
        d = n - 1
        while d & 1 == 0:
            d >>= 1

        witnesses = self.get_witnesses(n)

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes


#### START
n = int(input())

prime = Prime()
d = {}
for i in range(1, n+1):
    for k, v in prime.find_factors(i).items():
        if not k in d:
            d[k] = 0
        d[k] += v

ans = 1
for i in d.values():
    ans *= (i+1)
print(ans%1000000007)

Submission status: Accepted

Solution code:
memo={}
def primes(n):
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            if d in memo:
                memo[d]+=1
            else:
                memo[d]=1
            n //= d
        d += 1
    if n > 1:
        if n in memo:
            memo[n]+=1
        else:
            memo[n]=1
    return None
n=int(input())
for i in range(1,n+1):
    primes(i)
ans=1
for i in memo.items():
    ans*=i[1]+1
print(ans%(10**9+7))

Submission status: Accepted

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

def eratosthenes(n):
  primes=[True for i in range(n+1)]
  p=2
  while(p*p<=n):
    if primes[p]==True:
      for i in range(p*2,n+1,p):
        primes[i]=False
    p+=1
  ls=[]
  for i in range(2,n+1):
    if primes[i]:
      ls.append(i)
  return ls

ls=[]
primes=eratosthenes(n)
for prime in primes:
  power=prime
  exp=0
  while n >= power:
    exp+=n//power
    # print("prime",prime,"power",power,"n",n,"n//power",n//power)
    power*=prime
  ls.append(exp)
# print(ls)
mul=1
for i in ls:
  mul*=(i+1)
print(mul%mod)

Submission status: Accepted

Solution code:
N = int(input())

def primes(n):
    from math import sqrt
    p = [1] * (n + 1)
    for x in range(2, int(sqrt(n)) + 1):
        if p[x]:
            p[x * 2:n + 1:x] = [0] * ((n - x) // x)
    return (i for i in range(2, n + 1) if p[i])

prime_numbers = list(primes(1000))

from collections import defaultdict

cs = defaultdict(int)

for x in range(1, N + 1):
    for n in prime_numbers:
        while x % n == 0:
            cs[n] += 1
            x //= n

result = 1

MOD = 10**9 + 7

for x in cs.values():
    result = result * (x + 1) % MOD

print(result)

Submission status: Accepted

Solution code:
from math import sqrt

MOD = 10 ** 9 + 7


def primes(N):
    p = [True] * (N + 1)
    p[0] = p[1] = False
    for i in range(2, int(sqrt(N)) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i, x in enumerate(p) if x]


# --------------------
N = int(input())
P = primes(N)

factors = []

for p in P:
    i = p
    f = 0
    while i <= N:
        f += N // i
        i *= p
    factors.append(f)

ans = 1

for f in factors:
    ans *= f + 1
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def trial_division(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)
    #Only odd number is possible
    return a

D = {}

for i in range(1,N+1) :
    for d in trial_division(i) :
        if d not in D :
            D[d] = 1
        else :
            D[d] += 1

ans = 1

for d in D :
    ans *= (D[d]+1)
    ans %= 10**9+7

print(ans)

Submission status: Accepted

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

import math
FACT=dict()

for x in range(1,N+1):
    L=int(math.sqrt(x))



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

    if x!=1:
        FACT[x]=FACT.get(x,0)+1

ANS=1
for j in FACT.values():
    ANS=ANS*(j+1)%mod

print(ANS)

Submission status: Accepted

Solution code:
from collections import Counter


def f(N):
    d = []
    i = 2
    while N > 1:
        if N % i == 0:
            d.append(i)
            N //= i
        else:
            i += 1
    return d

def solve(N):
    c = Counter()
    for k in range(2, N + 1):
        c.update(f(k))
    ans = 1
    P = 10 ** 9 + 7
    for count in c.values():
        ans *= (count + 1)
        ans %= P
    return ans


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

Submission status: Accepted

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

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

p_dict={}
for i in range(2,n+1):
    facts=factorize(i)
    for p in facts:
        if p not in p_dict:
            p_dict[p]=1
        else:
            p_dict[p]+=1
ans=1
for i in p_dict.values():
    ans=(ans*(i+1))%mod
print(ans)

Submission status: Accepted

Solution code:
def factorize(n):
    # NOTE: if n == 1, return []
    if n < 1:
        raise Exception('Invalid input: n = {}'.format(n))
    i = 2
    ret = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            ret.append(i)
        i += 1
    if n > 1:
        ret.append(n)
    return ret

N = int(input())
d = {}
for i in range(2, N+1):
    facts = factorize(i)
    for f in facts:
        if f not in d:
            d[f] = 1
        else:
            d[f] += 1
cnt = 1
for v in d.values():
    cnt = (cnt * (v+1)) % (10**9+7)
print(cnt)

Submission status: Accepted

Solution code:
import math


def Primes(n):
    Prime = []
    Table = list(range(2, n))
    for k in range(2, int(math.sqrt(n-1))+1):
        if k == Table[0]:
            Prime.append(Table[0])
            Table = [i for i in Table if i % k]
    return Prime + Table if n > 2 else []


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

for p in Primes(n+1):
    m = 0
    for k in range(2, n+1):
        for _ in range(10):
            if k % p == 0:
                m += 1
                k = k // p
            else:
                break
    ans *= 1+m
print(ans % mod)

Submission status: Accepted

Solution code:
import math


def Primes(n):
    if n > 2:
        Prime = []
        Table = list(range(2, n))
        for k in range(2, int(math.sqrt(n-1))+1):
            if k == Table[0]:
                Prime.append(Table[0])
                Table = [i for i in Table if i % k]
        return Prime + Table
    else:
        return []


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

for p in Primes(n+1):
    m = 0
    for k in range(2, n+1):
        for _ in range(10):
            if k % p == 0:
                m += 1
                k = k // p
            else:
                break
    ans = (ans*((1+m) % mod)) % mod

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def f(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                    pf[j] = pf.get(j, 0) + 1
                    i //= j
    return pf

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

Submission status: Accepted

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

def nprf(n):
    pf = {}
    for i in range(2, n + 1):
        for j in range(2, i + 1):
            while i % j == 0:
                if not j in pf:
                    pf[j] = 0
                pf[j] += 1
                i //= j
    return pf
    
cnt = 1
for v in nprf(n).values():
    cnt *= (v + 1)
    
print(cnt % mod)

Submission status: Accepted

Solution code:
n = int(input())
lis = [i for i in range(n + 1)]
cnt = [0 for i in range(n + 1)]
for i in range(2, n + 1):
    for j in range(i, n + 1, i):
        while lis[j] % i == 0:
            cnt[i] += 1
            lis[j] //= i
ans = 1
for i in cnt:
    ans = ans * (i + 1) % 1000000007
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

MOD = 1000000007

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


if __name__ == '__main__':
    n = int(input())
    counter = defaultdict(int)
    for i in range(2, n + 1):
        primes(i)

    ans = 1
    for x in counter.values():
        ans *= x + 1
        ans %= MOD

    print(ans)

Submission status: Accepted

Solution code:
import math
N = 100000
prime = [True]*(N+1)
prime[0] = prime[1] = False
for i in range(N+1):
    if prime[i]:
        for j in range(2*i, N+1, i):
            prime[j] = False

n = int(input())
f = math.factorial(n)
res = 1

i = 2
while f!=1:
    if prime[i]:
        cc = 1
        while f%i==0:
            f=f//i
            cc+=1
        res*=cc
    i+=1
print(res%1000000007)

Submission status: Accepted

Solution code:
N = int(input())

pndic= {2:0}
for L in range(3,N+1):
    chk = True
    for L2 in pndic.keys():
        if L%L2 == 0: chk = False
    if chk: pndic[L] = 0

for i in range(1,N+1):
    for p in pndic.keys():
        tmp = 0
        while i % p == 0:
            i //= p
            tmp += 1
        pndic[p] += tmp

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

print(ans)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
from collections import defaultdict

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

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 LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def SI(): return input()


n = I()

prime_cnt = defaultdict(int)
for num in range(2, n + 1):
    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

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

print(ans)

Submission status: Accepted

Solution code:
# 素因数分解 ソート済みリスト (素因数,指数)
import math
N = int(input())
dict_count = {}
for i in range(1,N+1):
    dict_count[i] = 0

def factoring(n):
    sup = math.floor(pow(n,1/2))
    n_new = n
    for i in range(2,sup + 1):
        if n % i == 0:
            n_new = n // i
            dict_count[i] += 1
            break
    if n == n_new:
        dict_count[n_new] += 1
        return
    return factoring(n_new)

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

ans = 1
for i in range(1,N+1):
    ans *= dict_count[i] + 1
    ans %= 10**9 + 7
print(ans)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

N = int(input())
e = [0 for _ in range(N + 1)]

for x in range(2, N + 1):
    for p in range(2, x + 1):
        while x % p == 0:
            x //= p
            e[p] += 1

a = tuple(filter(lambda v: v > 0, e))
# print(a)
t = 1
for aa in a:
    t *= (aa + 1)
    t %= MOD
print(t)

Submission status: Accepted

Solution code:
def get_prime_factorized(N):
    R = []
    b, e = 2, 0
    while b ** 2 <= N:
        while N % b == 0:
            N  = N // b
            e += 1
        if e > 0:
            R.append([b, e])
        b, e = b + 1, 0
    if N > 1:
        R.append([N, 1])
    return R


N = int(input())
H = {}
R = 1

for n in range(1, N+1):
    for l in get_prime_factorized(n):
        k, c = l
        if k in H.keys():
            H[k] += c
        else:
            H[k]  = c

for k in H.keys():
    R *= (H[k]+1)
    R %= 10**9+7

print(R)

Submission status: Accepted

Solution code:
def primes_eratosthenes(n:int) -> list:
    isprime = [True] * (n+1)
    isprime[0] = isprime[1] = False

    for i in range(2, n+1):
        if isprime[i]:
            j = i + i
            while j <= n:
                isprime[j] = False
                j += i
    return [i for i in range(2,n+1) if isprime[i]]


def add_factor(d: dict, n: int, primes: list) -> dict:
    for p in primes:
        while n%p == 0:
            n /= p
            d[p] = d.get(p, 0) + 1
        if n==1:
            break
    return d 


def solve(n):
    primes = primes_eratosthenes(n)

    d = {}

    for i in range(2,n+1):
        d = add_factor(d, i, primes)

    MOD = 10**9 + 7
    ans = 1
    for v in d.values():
        ans = ans * (v+1) % MOD
    
    return ans
    

def main():
    n = int(input())
    ans = solve(n)
    print(ans)


main()

Submission status: Accepted

Solution code:
n=int(input())
if n<2:print(1)
else:
  l=[2]
  L=[1]
  for i in range(3,n+1):
    c=0
    for j in range(len(l)):
      if i%l[j]==0:
        c+=1
        while i%l[j]==0:
          i=int(i/l[j])
          L[j]+=1
    if c==0:
      l.append(i)
      L.append(1)
  ans=1
  for k in range(len(L)):
    ans*=(L[k]+1)
    ans=ans%(10**9+7)
  print(ans)

Submission status: Accepted

Solution code:
import math
# Euclid
def prime(n):
    prime_list = list(range(1, n + 1))
    for n_ in range(2, int(math.sqrt(n)) + 1):
        for p in prime_list:
            if p % n_ == 0 and p != n_:
                prime_list.remove(p)
    return prime_list


N = int(input())
p_list = prime(N)
prime_num = []

for _ in range(len(p_list)):
    prime_num.append(0)

for i in range(2, N+1):
    for j in range(1, len(p_list)):
        while i % p_list[j] == 0:
            prime_num[j] += 1
            i /= p_list[j]
# print(prime_num)
ans = 1
for n in prime_num:
    ans = ans * (n + 1) % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())

prime_table = [1] * (N+1)

for x in range(2, N+1):
    for t in range(2, x+1):
        while x % t == 0:
            prime_table[t] += 1
            x //= t
print(reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table))

Submission status: Accepted

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

F = [True]*(N+1)
F[0]=F[1]=False
P = []

for i in range(2,N+1):
    if F[i]==True:
        P.append(i)
        for j in range(i*2,N+1,i):
            F[j]=False

dic = defaultdict(int)
for i in range(2,N+1):
    for p in P:
        while i%p==0:
            dic[p] += 1
            i = i//p
        if i==1:
            break

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
# nまでの素数のテーブルを作る
def prime_table(n):
  list = [True for _ in range(n + 1)]
  i = 2
  while i * i <= n:
    if list[i]:
      j = i + i
      while j <= n:
        list[j] = False
        j += i
    i += 1

  table = [i for i in range(n + 1) if list[i] and i >= 2]
  return table

prime_table = prime_table(n)
ans = 1

for p in prime_table:
    count = 0
    for i in range(2,n+1):
        while i%p == 0:
            i /= p
            count += 1
    ans *= count+1

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

Submission status: Accepted

Solution code:
n=int(input())

def factorize(n):
    fct=[]
    b,e=2,0
    while b*b<=n:
        while n%b==0:
            n=n//b
            e=e+1
        if e>0:
            fct.append((b,e))
        b,e=b+1,0
    if n>1:
        fct.append((n,1))
    return fct

def d(n):
    l=factorize(n)
    r=1
    for i,j in l:
        r*=int(j)+1
    return r
ans=0

import math
ans=d(math.factorial(n))%1000000007

print(ans)