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())
mod = 10**9+7
arr = [1 for i in range(N+1)]
for i in range(2,N+1):
    if arr[i] > 0:
        j = 2*i
        while(j<N+1):
            arr[j] = 0
            j += i
prime = []
for i in range(2,N+1):
    if arr[i] != 0:
        prime.append(i)
count = 1
for n in prime:
    tmp = n
    i = 0
    while(tmp < N+1):
        i += N//tmp
        tmp *= n
    count *= (i+1)
print(count%mod)

Submission status: Accepted

Solution code:
N=int(input())
num=1
factors=[]
for i in range(N,1,-1):
    num*=i

r=2
while num!=1:
    x=0
    while num%r==0:
        num//=r
        x+=1
    if x:
        factors.append(x)
    r+=1

result=1
for i in factors:
    result*=i+1

print(result%1000000007)

Submission status: Accepted

Solution code:
const = 10 ** 9 + 7
N = int(input())
TABLE = [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]
T = []
ans = 1
for x in TABLE:
    L = []
    for i in range(1,N + 1):
        count = 0
        while i % x == 0:
            i /= x
            count += 1
        L.append(count)
    T.append(sum(L)+1)
#print(T)
for x in T:
    ans *= x
print(ans % const)

Submission status: Accepted

Solution code:
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        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]]
n = int(input())
prime = primes(n)
a = [1]*n
for i in range(1,n+1):
    for p in prime:
        while i%p == 0:
            i = i//p
            a[p-1] += 1
ans = 1
for i in a:
    ans *= i
mod = 10**9 + 7
print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
prime = [2]
for i in range(3, n+1):
	if all(i % x for x in prime):
		prime.append(i)
ans = 1
p = 1000000007
for x in prime:
	a = n
	cnt = 0
	while(a!=0):
		cnt += a//x
		a //= x
	ans = ans * (cnt+1) % p
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = []
ans = 1
for i in range(2,n+1):
    for j in range(2,i):
        if i % j == 0:
            break
    else:
        l.append(i)

for h in l:
    a = 1
    for i in range(1,n+1):
        while i % h == 0:
            i /= h
            a += 1
    else:
        ans *= a

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

Submission status: Accepted

Solution code:
from math import factorial

N = int(input())
N = factorial(N)

i = 2
num = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        num += 1
    else:
        i += 1
        ans *= num
        num = 1
print(ans * num % (10**9 + 7))

Submission status: Accepted

Solution code:
def main():
    primes = [2]
    for x in range(3, 1000, 2):
        if any(map(lambda p: x % p == 0, primes)):
            continue
        primes.append(x)

    powers = dict()
    for p in primes:
        powers[p] = 0

    n = int(input())
    for i in range(2, n + 1):
        for p in primes:
            if p > i:
                break
            ii = i
            while ii % p == 0:
                ii //= p
                powers[p] += 1

    res = 1
    for power in powers.values():
        res = (res * (power + 1)) % 1000000007
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
p = 10**9 + 7
m = [2]
for i in range(n+1):
    for j in range(2, i):
        if i % j == 0:
            break
        if j == i-1:
            m.append(i)

a = [0]*len(m)

for i in range(1, n+1):
    for j in range(len(m)):
        while i % m[j] == 0:
            a[j] += 1
            i //= m[j]
ans = 1
for i in a:
    ans *= (i+1) % p
print(ans%p)

Submission status: Accepted

Solution code:
# わがらんぞー

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

N = int(input())

p = [0]*(N+1)

for i in range(2, N+1):
    for j in range(2, i+1):
        if is_prime(j) == False:
            continue
        while i%j==0:
            i //= j
            p[j] += 1
        if i == 1:
            break

r = 1
for q in p:
    r = r * (q+1)
print(r%(10**9+7))

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
# 0以上整数x「未満」の素数をリストに格納して返す
n = int(input())
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0  # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
pr = primes(n + 1)
q = math.factorial(n)
di = {}
di = defaultdict(int)
for i in pr:
    while q % i == 0:
        q = q // i
        di[i] += 1

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

Submission status: Accepted

Solution code:
N = int(input())
p = 10 ** 9 + 7
primes = []
for i in range(1, N + 1):
  for j, prime in enumerate(primes):
    while i % prime[0] == 0:
      primes[j][1] += 1
      i //= prime[0]
    if i < prime[0]:
      break
  if i > 1:
    primes.append([i, 2])
ans = 1
for k, v in primes:
  ans *= v
  ans %= p
print(ans)

Submission status: Accepted

Solution code:
def c_factors_of_factorial(N):
    import math

    def prime_decomposition(n):
        # nを素因数分解
        from collections import defaultdict
        i = 2
        table = defaultdict(int)
        while i**2 <= n:
            while n % i == 0:
                n //= i
                table[i] += 1
            i += 1
        if n > 1:
            table[n] += 1
        return table

    exp_list = prime_decomposition(math.factorial(N))
    ans = 1
    for v in exp_list.values():
        ans = (ans * (v + 1)) % (10**9 + 7)
    return ans

N = int(input())
print(c_factors_of_factorial(N))

Submission status: Accepted

Solution code:
def c_factors_of_factorial(N):
    def exponential_list(n):
        # ret[k]: n!を素因数分解したときのkの指数
        ret = {}
        for j in range(2, n + 1):
            current = j
            ret[j] = 0
            for k in range(2, j + 1):
                while current % k == 0:
                    ret[k] += 1
                    current //= k
            if ret[j] == 0:
                ret.pop(j)
        return ret

    exp_list = exponential_list(N)
    ans = 1
    for e in exp_list.values():
        ans *= e + 1
        ans %= 10**9 + 7
    return ans

N = int(input())
print(c_factors_of_factorial(N))

Submission status: Accepted

Solution code:
N = int(input())
MOD = int(1e+9) + 7



prime = [2]

for i in range(2, 1001):
    for j in range(2,i-1):
        if i % j == 0:
            break

    else:
        prime.append(i)

factor = [1] * 1001


for i in range(1, N+1):
    for p in prime:
        if i == 1:
            break
        while i % p == 0:
            i /= p
            factor[p] += 1

ans = 1
for fact in factor:
    ans *= fact
    ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())

tab = [0] * (N + 1)

for i in range(2, N + 1):
    i_tmp = i
    for p in range(2, N + 1):
        if p < 2: break
        elif i_tmp % p > 0: continue
        for j_p in range(1, 32 + 1):
            if i_tmp % (p ** (j_p + 1)) > 0: break
        i_tmp = i_tmp // (p ** j_p)
        tab[p] += j_p

# print("#", tab)

ans = 1
for tab_i in tab:
    if tab_i < 1: continue
    else: ans = (ans * (tab_i + 1)) % (10 ** 9 + 7)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
num = 1
factors = []

for i in range(N, 1, -1):
    num *= i

r = 2
while num != 1:
    x = 0
    while num % r == 0:
        num //= r
        x += 1
    if x:
        factors.append(x)
    r += 1

result = 1
for i in factors:
    result *= i+1

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

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
fact = {}
for j in range(2, N+1):
    for i in range(2, j+1):
        while j % i == 0:
            if i in fact.keys():
                fact[i] += 1
            else:
                fact[i] = 2
            j //= i
ans = 1
for v in fact.values():
    ans *= v
    ans %= mod
print(ans)

Submission status: Accepted

Solution code:
# 入力 : 自然数     ex) 12
# 出力 : 約数リスト ex) [(2,2),(3,1)]
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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 divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base ** exponent
    return a


# 入力:整数n      ex)100
# 出力:約数リスト ex)[1, 5, 25, 2, 10, 50, 4, 20, 100]
def divisorEnumulation(n):
    divisor = []
    for div in divisorize(factorize(n)):
        divisor.append(num(div))
    return divisor


n = int(input())
# n!を素因数分解すれば約数の個数は自明
fact = [0 for i in range(10 ** 3 + 1)]
for i in range(2, n+1):
    tmpFact = factorize(i)
    for div in tmpFact:
        fact[div[0]] += div[1]
out = 1
for _fact in fact:
    # print(_fact)
    out *= _fact + 1
    out %= 10**9+7
print(out % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
from math import factorial

N = factorial(int(input()))

i = 2
check = 1
ans = 1
while N != 1:
    if N % i == 0:
        N //= i
        check += 1
    else:
        ans *= check
        check = 1
        i += 1
print((ans*check)%(10**9+7))

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*n
for i in range(1,n+1):
    b=2
    while b<=i:
        while i%b==0:
            i//=b
            l[b-1]+=1
        b+=1
#print(l)
x=1
for i in l:
    if i!=0:
        x=x*(i+1)%(10**9+7)
print(x)

Submission status: Accepted

Solution code:

n=int(input())
l=[0]*n

for i in range(1,n+1):
    b=2
    while b <= i:
        while i%b==0:
            i = i//b
            l[b-1]+=1
        b+=1
x=1
for i in l:
    if i != 0:
        x=x*(i+1)%(10**9+7)
print(x)

Submission status: Accepted

Solution code:
import math
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


n = int(input())
n_fra = math.factorial(n)
p_f = prime_factorize(n_fra)
count = 1

for k, v in p_f.items():
    count *= (v+1)
    count %= 10**9+7
print(count)

Submission status: Accepted

Solution code:
import math


def combination(n, r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


N = int(input())
ans = N

m = {}
for i in range(2, N+1):
    for _i in range(2, i+1):
        if i % _i == 0:
            m.setdefault(i, 0)
            if not(is_prime(_i)):
                continue
            a = i
            b = _i
            while(True):
                m[_i] += 1
                n = a//b
                if n % _i != 0:
                    break
                a = n

ans = 1
for v in m.values():
    ans *= (v+1)
print(ans % 1000000007)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None

def make_divisors():
    retval = [0]
    for target in range(1, 1001):
        D = collections.defaultdict(lambda: 0)
        
        d = 2
        while target != 1:
            if target % d == 0:
                D[d] += 1
                target //= d
            else:
                d += 1

        retval.append(dict(D))
    
    return retval


def main():
    N = int(input())
    D = make_divisors()[1:N+1]

    ansD = collections.defaultdict(lambda: 0)

    for d in D:
        for k,v in d.items():
            ansD[k] += v

    ans = 1

    for d in ansD.values():
        ans *= (d+1)

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



main()

Submission status: Accepted

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

N = int(input())

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

lis = factorize(N)

ans = 1
for l in lis:
    ans *= (l[1] + 1)
    ans %= 1000000007
print(ans)

Submission status: Accepted

Solution code:
list=[[0 for i in range(1001)] for j in range(1001)]
N=int(input())
i=1
while i<=1000:
    a=i
    while a%2 == 0:
        a/=2
        list[i][2]+=1
    div=3
    while div <= a:
        if a%div == 0:
            a/=div
            list[i][div]+=1
            continue
        div+=2
    i+=1
anslist=[1,]*1001
for i in range(N+1):
    for j in range(N+1):
        anslist[j]+=list[i][j]
ans=1
for i in range(1001):
    ans*=anslist[i]
print(str(ans%(10**9+7)))

Submission status: Accepted

Solution code:
# time complexity: O(N√N)

from collections import defaultdict


def prime_factorize(n, prime_numbers):
    i = 2
    while i * i <= n:
        if n % i == 0:
            exponent = 0
            while n % i == 0:
                n //= i
                exponent += 1
            prime_numbers[i] += exponent
        i += 1
    if n != 1:
        prime_numbers[n] += 1
    return prime_numbers


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

prime_numbers = defaultdict(int)
for n in range(1, N + 1):
    prime_factorize(n, prime_numbers)

num_divisors = 1
for exponent in prime_numbers.values():
    num_divisors *= (exponent + 1)
    num_divisors %= MOD

print(num_divisors)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_primes(n):
    sieve = [True]*(n+1)
    primes = []
    reslut = 1
    for i in range(2, n+1):
        if sieve[i]:
            primes.append(i)
            for j in range(i, n+1, i):
                sieve[j] = False
    return primes

def solve(n):
    mod = 10**9 + 7
    primes = get_primes(n)
    result = 1
    for prime in primes:
        count = 0
        i = prime 
        while i <= n:
            count += n//i
            i *= prime
        result = result*(count + 1)%mod
    return result
    

n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
import math
import collections

N = int(input())
a = math.factorial(N)
check = []
ans = 1
i = 2

while a != 1:
    if a % i == 0:
        a //= i
        check.append(i)
    else:
        i += 1
        
check = collections.Counter(check).values()
for i in check:
    ans *= (i+1)
    ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

N = int(input())

div = 10**9 + 7

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

primfac = primes(math.factorial(N))
fcnt = {}
for a in primfac:
    if a in fcnt:
        fcnt[a] += 1
    else:
        fcnt[a] = 1

ans = 1
for k,v in fcnt.items():
    ans *= v + 1

# print(fcnt)
print(ans%div)


# primfac.extend([1])
# print(math.factorial(N))
# print(primfac)
# print(math.factorial(N)%(10**9+7))

Submission status: Accepted

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


def prime(t):
    i=2
    while i**2<=t:
        if t%i==0: return 0
        i+=1
    return 1

mod=10**9+7

p=[]
for i in range(2,1008):
    if prime(i):
        p.append(i)

d={i:0 for i in p}
n=int(input())

ans=tmp=1
for i in range(1,n+1):
    tmp*=i
    for j in p:
        while tmp%j==0:
            d[j]+=1
            tmp//=j
        if tmp<j: break

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

Submission status: Accepted

Solution code:
from math import sqrt

def make_prime_list(n):
    if n < 2:
        return []
    numbers = [i for i in range(n)]
    numbers[1] = 0
    for number in numbers:
        if number > sqrt(n):
            break
        if number == 0:
            continue
        for non in range(2*number, n, number):
            numbers[non] = 0
    return [number for number in numbers if number != 0]

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

dictionary = {}
primes = make_prime_list(N+1)

for prime in primes:
    dictionary[prime] = 0
    x = prime
    while x <= N:
        dictionary[prime] += N // x
        x *= prime

answer = 1
for value in dictionary.values():
    answer *= value + 1
    answer %= MOD
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
M = 10 ** 5 + 1
rec = [0] * M
for i in range(1, N + 1):
    k = i
    for j in range(2, N + 1):
        while k >= 2 and k % j == 0:
            k //= j
            rec[j] += 1

num = 1
for k in list(filter(lambda x: x > 0, rec)):
    num *= k + 1
    num %= MOD

print(num)

Submission status: Accepted

Solution code:
def 解():
    iN = int(input())
    iD = 10**9 + 7


    if iN < 3:
        print(iN)
        exit()

    d素={2:1}
    for i in range(2,iN + 1):
        b素 = 1
        for j in range(2,int(i**0.5)+2):
            if i % j == 0:
                b素 = 0
                break
        if b素 :
            d素[i]=1
    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
            if i == 0:
                break
    iAns = 1
    for i素,num in d素.items():
        iAns *= num
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:

def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    aS = [1]*(iN+1)
    dP={}
    for i in range(2,iN+1):
        if aS[i]:
            dP[i] = 1
            for j in range(i*2,iN+1,i):
                aS[j] = 0

    for i in range(2,iN+1):
        for iP in dP:
            while i % iP == 0:
                dP[iP]+=1
                i //= iP
            if i == 1:
                break
    iAns = 1
    for iP in dP:
        iAns *= dP[iP]
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:
def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    aS = [1]*(iN+1)
    dP={}
    for i in range(2,iN+1):
        if aS[i]:
            dP[i] = 1
            for j in range(i*2,iN+1,i):
                aS[j] = 0

    for i in range(2,iN+1):
        for iP in dP:
            while i % iP == 0:
                dP[iP]+=1
                i //= iP
    iAns = 1
    for iP in dP:
        iAns *= dP[iP]
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:
def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    aS = [1]*(iN+1)
    d素={}
    for i in range(2,iN+1):
        if aS[i]:
            d素[i] = 1
            for j in range(i*2,iN+1,i):
                aS[j] = 0

    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
    iAns = 1
    for i素 in d素:
        iAns *= d素[i素]
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:
def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    i上限 = int(iN**0.5)+1
    a篩 = [1]*(iN+1)
    d素={}
    for i in range(2,iN+1):
        if a篩[i]:
            d素[i] = 1
            for j in range(i*2,iN+1,i):
                a篩[j] = 0

    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
    iAns = 1
    for i素 in d素:
        iAns *= d素[i素]
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:

def 解():
    iN = int(input())
    iD = 10**9 + 7

    if iN < 3:
        print(iN)
        exit()

    i上限 = int(iN**0.5)+1
    a篩 = [1]*(iN+1)
    d素={}
    for i in range(2,iN+1):
        if a篩[i]:
            b素 = 1
            for i素 in d素:
                if i % i素 == 0:
                    b素=0
                    break
            if b素:
                d素[i] = 1
                for j in range(i,iN+1,i):
                    a篩[j] = 0
                    
    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
    iAns = 1
    for i素 in d素:
        iAns *= d素[i素]
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:

def 解():
    iN = int(input())
    iD = 10**9 + 7


    if iN < 3:
        print(iN)
        exit()

    d素={2:1}
    for i in range(2,iN + 1):
        b素 = 1
        for j in range(2,int(i**0.5)+2):
            if i % j == 0:
                b素 = 0
                break
        if b素 :
            d素[i]=1
    for i in range(2,iN+1):
        for i素 in d素:
            while i % i素 == 0:
                d素[i素]+=1
                i //= i素
    iAns = 1
    for i素,num in d素.items():
        iAns *= num
        iAns %= iD
    print(iAns)
解()

Submission status: Accepted

Solution code:
N = int( input())
F = [0]*(N+1)
Q = 10**9 + 7
for i in range(1,N+1):
    n = i
    for j in range(2, int( N**(1/2))+1):
        while n%j == 0:
            F[j] += 1
            n //= j
    if n != 1:
        F[n] += 1
ans = 1
for i in range(N+1):
    ans *= F[i]+1
    ans %= Q
print(ans)

Submission status: Accepted

Solution code:
#! /usr/bin/python3
# Factors of Factorial

"""
1≦N≦103
"""

import math
import collections
# import sympy

test = False

N = int(input())


def prime_factors(n):
    """
    自然数 n の素因数のリスト
    """
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            # n = n // i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors


def yakusu_no_kosu(n):
    """
    n! の約数の個数
    """

    l = prime_factors(math.factorial(n))
    c = collections.Counter(l)
    l_c = list(c.values())
    if test:
        print('l =', l)
        print('c =', c)
        print('l_c =', l_c)


    kosu = 1
    # 約数の数
    for v in l_c:
        kosu *= v + 1
    # 各素因数(key)の個数v(value)から約数の個数を算出

    """
    d = sympy.factorint(math.factorial(n))
    # n!を素因数分解 {素因数1: 個数, 素因数2: 個数, …}
    l_d = list(d.values())
    # 各素因数(key)の個数(value)のみリストにする

    if test:
        print('l_d =', l_d)

    kosu = 1
    # 約数の数

    for v in l_d:
        kosu *= v + 1
    # 各素因数(key)の個数v(value)から約数の個数を算出
    """

    return kosu


def main():
    """
    N! の約数の個数を 10^9+7 で割った余りを出力
    """
    print(yakusu_no_kosu(N) % (10**9 + 7))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
MOD = int(1e9)+7

ps = []
ans = 1
for n in range(2, N+1):
    for p in ps:
        if n%p == 0:
            break
    else:
        ps.append(n)
     
        cnt = 0
        i = 1
        while True:
            c = N//(n**i) 
            if c==0: 
                break
            else:
                cnt += c
                i += 1
        ans *= (cnt+1)
        ans %= MOD
                
print(ans)