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

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



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



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



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



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

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):


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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):

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)  
            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(ans%div)

Solution (Python):



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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)
解()

Solution (Python):

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

Solution (Python):
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)
解()

Solution (Python):
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)
解()

Solution (Python):
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)
解()

Solution (Python):

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

Solution (Python):

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

Solution (Python):
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)

Solution (Python):



"""
1≦N≦103
"""

import math
import collections


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

    """
    d = sympy.factorint(math.factorial(n))
    
    l_d = list(d.values())
    

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

    kosu = 1
    

    for v in l_d:
        kosu *= v + 1
    
    """

    return kosu


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


if __name__ == '__main__':
    main()

Solution (Python):
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)

Solution (Python):
N = int(input())

prime = [2]
for i in range(3,1001):
    flag = 0
    for j in prime:
        if i % j == 0:
            flag = 1
    if flag == 0:
        prime.append(i)

prime_count = [0 for i in range(1001)]

for i in range(1, N+1):
    for j in prime:
        while i % j == 0:
            prime_count[j] += 1
            i = int(i/j)
ans = 1
for i in range(1001):
    ans *= (prime_count[i]+1)
    ans %= 1000000007
print(ans)

Solution (Python):
n=int(input())
a=[0]*(n+1)
ans=1
for i in range(2,n+1):
    x=i
    p=2
    while x>1:
        while x%p==0:
            a[p]+=1
            x//=p
        p+=1
for i in a:
    ans=(ans*(i+1))%(10**9+7)
print(ans)

Solution (Python):
n = int(input())

p=[]
for k in range(2,n+1):
  flag = True
  for i in p:
    if k%i == 0:
      flag = False
      break
  if flag:
    p += [k]

a = 1
for i in p:
  s = 1
  x = n//i
  while x>0:
    s += x
    x = x//i
  a = a*s%1000000007
print(a)

Solution (Python):
n = int(input())
cnt = [0]*(n+1)
for i in range(2,n+1):
    s = i
    while s != 1:
        for j in range(2,n+1):
            if s % j == 0:
                s //= j 
                cnt[j] += 1
                break

c = 1
for i in range(2,n+1):
    c *=(cnt[i]+1)
    c %=(10**9+7)

print(c)

Solution (Python):



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


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


divisor = {}
for i in range(2, n + 1):
    primes = prime_factorization(i)
    for p in primes:
        if p in divisor:
            divisor[p] += 1
        else:
            divisor[p] = 1

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

Solution (Python):
N = int(input())
fact = 1
mod = 10**9 + 7

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

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


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

s = 0
R = primes(N)

I = fact

soinsu = []
tmp = 1
cnt = 1
ans = 1
while s==0:
    for i in R:

        if I%i==0:
            I=I//i
            if I==1:
                s=1

            if i == tmp:
                cnt += 1
            else:
                ans *= (cnt + 1)
                ans %= mod
                cnt  = 1
                tmp = i
            break








print(ans)

Solution (Python):
n = int(input())
p = [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,10000]

ass = []
m = 10**9+7
k = 0
while p[k] <= n:
    a = 0
    i = 1
    while p[k]**i <= n:
        a += (n//(p[k]**i))
        i += 1
    ass.append(a%m)
    k += 1
ans = 1
for i in range(len(ass)):
    ans = ans * (ass[i]+1) % m
print(ans)

Solution (Python):
import math

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

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    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]
    
d = {}
P = primes(N + 1)

for p in P:
    d[p] = 0
    k = p
    while k <= N:
        d[p] += N // k
        k *= p

res = 1
for v in d.values():
    res *= v + 1
    
res %= mod
print(res)

Solution (Python):
import math

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

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    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]
    
d = {}
P = primes(N + 1)

for p in P:
    d[p] = 0
    k = p
    while k <= N:
        d[p] += N // k
        k *= p

res = 1
for v in d.values():
    res *= v + 1
    res %= mod
print(res)

Solution (Python):
n = int(input())
s = [2]
q = 1

for i in range(n+1):
	if i<3:
		continue
	t = []
	for j in range(len(s)):
		t.append((i)%s[j])
	if 0 in t:
		q = 3
	else:
		s.append(i)

x = 1

for i in range(len(s)):
	m = 0
	for j in range(10):
		m += n//(s[i]**(j+1))
	x *= m+1
print(x%(10**9+7))

Solution (Python):
N = int(input())
Prime = {}
mod = 7 + 10**9

if N > 2:
    Prime[2] = 1
    for i in range(3, N+1):
        M = i
        newPrime = True
        for j in Prime:
            if M % j == 0:
                newPrime = False
                while M % j == 0:
                    M //= j
                    Prime[j] += 1
        if newPrime:
            Prime[i] = 1
    
    ans = 1
    for p in Prime:
        ans *= Prime[p] + 1
        ans %= mod
    print(ans)

else:
    print(N)

Solution (Python):
num = int(input())
cnt_list = [0] * (num+1)
ans = 1

for i in range(2,num+1):
    x = i
    prime = 2
    while x > 1:
        while x%prime == 0:
            cnt_list[prime] += 1
            x = x//prime
        prime += 1

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

Solution (Python):
import math
N = int(input())
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
i = 2
primedic = {}
primelist = []
while i <= 1000:
  if is_prime(i) == True:
    primedic[i] = 0
    primelist.append(i)
  i += 1
def usage(n):
    fct = factorize(n)
    return(fct)
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 num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
j = 2
while j <= N:
  li = usage(j)
  for array in li:
    primedic[array[0]] += array[1]
  j += 1
ans = 1
for keys in primedic:
  ans = (ans*(primedic[keys]+1))%(10**9+7)
print(ans)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def prime_factor_decomposition(n):
    import math
    m = defaultdict(int)
    while n > 1:
        find_factor = False
        for i in range(2, int(math.sqrt(n)) + 1):

            if n % i == 0:
                m[i] += 1
                n //= i
                find_factor = True
                break

        if not find_factor:
            m[n] += 1
            break

    return m


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

    d = defaultdict(int)
    for x in range(1, N + 1):
        p = prime_factor_decomposition(x)
        for k, v in p.items():
            d[k] += v

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


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=[0]*(n+1)
ans=1
for i in range(2,n+1):
    x=i
    p=2
    while x>1:
        while x%p==0:
            a[p]+=1
            x//=p
        p+=1
for i in a:
    ans=(ans*(i+1))%(10**9+7)
print(ans)

Solution (Python):
s = [i for i in range(1001)]
s[0] = 0
s[1] = 0
i = 2
while i < len(s):
    j = i * 2
    while s[i] != 0:
        if j >= len(s):
            break
        s[j] = 0
        j += i
    i += 1

N = int(input())
cnt = [0 for i in range(1001)]
for i in range(1, N + 1):
    j = 1
    while i != 1:
        while s[j] == 0:
            j += 1
        while i % j == 0:
            cnt[j] += 1
            i /= j
        j += 1
ans = 1
for i in s:
    if i != 0:
        ans *= cnt[i] + 1
print(ans % (10 ** 9 + 7))

Solution (Python):
N=int(input())
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 = num**(0.5)

    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

list=sieve_of_erastosthenes(max(N+1,6))
ans=1
for i in range(N+1):
    if list[i]:
        tmp=0
        M=N
        for t in range(1,10):
            if M//(i**t)==0:    break
            tmp+=M//(i**t)
        ans*=tmp+1
print(ans%(10**9+7))

Solution (Python):
from math import sqrt,floor
MODN = int(1e9 +7)
N = int(input())

divnum = {}
if N==1:
  print(1)
  exit(0)
  
for i in range(1,N+1):
  work = i
  div = 2
  while work > 1:
    if work % div == 0:
      work = work // div
      if div in divnum:
        divnum[div] += 1
      else:
        divnum[div] = 1
    else:
      div += 1

ans = 1
for k,v in divnum.items():
  ans = ans * (v+1) % MODN
  
print(ans)

Solution (Python):
N=int(input());q=1;t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)

Solution (Python):
N=int(input())
q=1
t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)

Solution (Python):

def sieve(n):
    '''
    :param n:
    :return: n以下の素数のリストを返す
    エラトステネスの篩→O(n log log n)
    '''
    prime = []
    is_prime = [True] * (n + 1) 
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if is_prime[i]:
            prime.append(i)
            for j in range(2 * i, n + 1, i):
                is_prime[j] = False
    return prime

N = int(input())
P = sieve(N)
ans = 1
for p in P:
    a = 0
    b = N // p
    while b > 0:
        a += b
        b //= p
    ans = ans * (a + 1) % (10 ** 9 + 7)
print(ans)

Solution (Python):
N = int(input())

dic = {}
ans = 1

def calc(N):
    n = N
    for i in range(2, N + 1):
        while n % i == 0:
            if i not in dic:
                dic[i] = 1
            else:
                dic[i] += 1
            n = int(n / i)

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

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

print(ans)

Solution (Python):
from collections import Counter

def factorize(n: int):
    d = Counter()
    m= 2
    
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
            
        m += 1
        
    if n > 1:
        d[n] += 1
        
    return d

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

fac = Counter()
for i in range(2,n+1):
    fac += factorize(i)
    
ans = 1
for k,v in fac.items():
    ans *= (v+1)
    ans %= MOD
    
print(ans)

Solution (Python):
N=int(input())
list1=[]
for i in range(1001):
    list1.append(0)

for j in range(1,N+1):
    A=j
    for k in range(2,N+1):
        for l in range(11):
            if A%k==0:
                list1[k]+=1
                A=A/k
            else:
                break
ans=1
for m in range(1,len(list1)):
    if list1[m]==0:
        pass
    else:
        ans*=list1[m]+1
        if ans>=10**9+7:
            ans=ans%(10**9+7)
            
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

n = int(input())

def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)

num = factorial(n)

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

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