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:
import math
x=int(raw_input())

prime=[True]*(x+1)
prime[0:2]=[False]*2
for i in range(2,x+1):
    if prime[i]:
        for j in range(i*2,x+1,i):
            prime[j]=False

prime_num=[0]*(x+1)

for i in range(0,x+1):
    if prime[i]:
        j=i
        while True:
            prime_num[i]+=x/j
            j*=i
            if j>x:
                break


print reduce(lambda p,x:p*(x+1),prime_num,1)%(10**9+7)

Submission status: Accepted

Solution code:
#coding: UTF-8
import math
N=int(input())
def prime_list(k):
    lis=[True for i in range(1,k+1)]
    lis[0]=False
    for i in range(2,k+1):
        j=2
        while j*j<=i:
            if i%j==0:
                lis[i-1]=False
                break
            else:
                j+=1
    return lis
#    print(lis)
def p_fact(k,N,plist):
#    plist=prime_list(k)
    lis=[0]*N
    for i in range(0,k):
        n=0
        if plist[i]:
            while k%(i+1)==0:
                n+=1
                k=k/(i+1)
        lis[i]=n
    return lis
#    print(lis)
out_lis=[0]*N
plist=prime_list(N)
for i in range(1,N+1):
    input_lis=p_fact(i,N,plist)
    out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]
#print(out_lis)
out=1
for i in range(0,N):
    out=out*(out_lis[i]+1)
#print(out%1000000007)
print(out%(10**9+7))

Submission status: Accepted

Solution code:
N = int(input());
#prime number
P = [0]*N;
#divisor
D = 1;
if N>=2:
    for i in range(2,N+1):
        for j in range(2,i+1):
            while i%j ==0:
                P[j-1] = P[j-1]+1;
                i = i/j
for i in range(N):
    D = D*(P[i]+1)
print(D%1000000007);

Submission status: Accepted

Solution code:
#coding: UTF-8
import math
N=int(input())
def prime_list(k):
    lis=[True for i in range(1,k+1)]
    lis[0]=False
    for i in range(2,k+1):
        j=2
        while j*j<=i:
            if i%j==0:
                lis[i-1]=False
                break
            else:
                j+=1
    return lis
#    print(lis)
def p_fact(k,N):
    plist=prime_list(k)
    lis=[0]*N
    for i in range(0,k):
        n=0
        if plist[i]:
            while k%(i+1)==0:
                n+=1
                k=k/(i+1)
        lis[i]=n
    return lis
out_lis=[0]*N
for i in range(1,N+1):
    input_lis=p_fact(i,N)
    out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]
#print(out_lis)
out=1
for i in range(0,N):
    out=out*(out_lis[i]+1)
print(out%1000000007)

Submission status: Accepted

Solution code:
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]
n = int(input())
ans = 1
for i in prime:
    if i <= n:
        m = n
        multi = 0
        while m >= i:
            multi += m // i
            m = m // i
        multi += 1
        ans *= multi
print(ans % (10**9 + 7))

Submission status: Accepted

Solution code:
def isPrime(n):
	i = 2
	while i*i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

N = 1000
Prime = []

for i in range(2,N):
	if isPrime(i):
		Prime.append(i)
		
dic = {}
for i in Prime:
	dic[i] = 0

p = int(input())
for k in range(2, p+1):
	for i in Prime:
		while k % i == 0:
			k /= i
			dic[i] += 1

ans = 1
for i in Prime:
	ans *= (1+dic[i])

print(ans % 1000000007)

Submission status: Accepted

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

n=int(input())
ans=1
for p in prime:
    k=1
    m=0
    while p**k <=n:
        m += n//p**k

        k +=1

    ans *= m+1

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

Submission status: Accepted

Solution code:
from collections import Counter
N = int(raw_input())
d = Counter()

for i in range(1, N+1):
    n = i
    for p in range(2, i+1):
        while n % p == 0:
            n /= p
            d[p] += 1
ans = 1
for p in d:
    ans *= d[p] + 1
    ans %= 10 ** 9 + 7
print ans

Submission status: Accepted

Solution code:
MOD = int(1e9 + 7)
n = int(input())
# es[i] := pi ** es[i]
es = [0] * 1010


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


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

ans = 1
for i in range(1, n + 1):
    ans *= es[i] + 1

print(ans % MOD)

Submission status: Accepted

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

import collections
import functools
import math
import operator


P = 1000000007


def sieve_of_eratosthenes(end):
    assert end > 1
    is_prime = [True for _ in range(end)]
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def factorize_fact(n, primes):
    factors = collections.Counter()
    if n < 2:
        return factors
    for p in primes:
        if p * p > n:
            break
        while n % p == 0:
            factors[p] += 1
            n //= p
    if n > 1:
        factors[n] += 1
    return factors


def sum_ctrs(counters):
    return functools.reduce(operator.add, counters, collections.Counter())


def prod_mod(iterable, mod=P):
    def multi_mod(x, y):
        return (x % mod) * (y % mod) % mod
    return functools.reduce(multi_mod, iterable, 1)


def sum_of_divs_of_fact(n, mod=P):
    primes = sieve_of_eratosthenes(math.ceil(math.sqrt(n)) + 1)
    ctr = sum_ctrs(factorize_fact(x, primes) for x in range(1, n + 1))
    ans = prod_mod(v + 1 for v in ctr.values()) % mod
    return ans


def main():
    print(sum_of_divs_of_fact(int(input())))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#ARC052C

n=int(raw_input())
s=[1 for i in range(n+1)]
res=1
for i in range(2,n+1):
 if s[i]:
  for j in range(i*2,n+1,i):
   s[j]=0
  cnt=0
  temp=n
  while temp:
   cnt+=temp/i
   temp/=i
  res=res*(cnt+1)%(10**9+7)
print res

Submission status: Accepted

Solution code:
import math
 
N = int(input())
mod = 10**9+7
 
def get_primes(n):
    ps = [0, 0] + [i for i in range(2, n+1)]
    for i in range(2, n+1):
        if ps[i] == 0:
            continue
        for j in range(i * i, n+1, i):
            ps[j] = 0
    return [p for p in ps if p]
 
 
prime = get_primes(N)
 
ans = 1
for p in prime:
    tmp = 0
    for i in range(1, int(math.log(N, p))+1):
        tmp += N // (p**i)
 
    ans = (ans * (tmp + 1)) % mod
 
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

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

for p in primes:
    if p <= N:
        pow_p = p
        s = 0
        while pow_p <= N:
            s += N // pow_p
            pow_p *= p
        arr.append(s + 1)

if N == 1:
    print(1)
else:
    print(reduce(lambda a, b: (a * b) % MOD, arr))

Submission status: Accepted

Solution code:
from functools import reduce
MOD = 10**9 + 7
primes = list(map(int, "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".split(" ")))

N = int(input())
arr = []

for p in primes:
    if p <= N:
        pow_p = p
        s = 0
        while pow_p <= N:
            s += N // pow_p
            pow_p *= p
        arr.append(s+1)

if N == 1:
    print(1)
else:
    print(reduce(lambda a, b: (a * b) % MOD, arr))

Submission status: Accepted

Solution code:
import math

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

def get_primes(n):
    ps = [0, 0] + [i for i in range(2, n+1)]
    for i in range(2, n+1):
        if ps[i] == 0:
            continue
        for j in range(i * i, n+1, i):
            ps[j] = 0
    return [p for p in ps if p]


prime = get_primes(N)

ans = 1
for p in prime:
    tmp = 0
    for i in range(1, int(math.log(N, p))+1):
        tmp += N // (p**i)

    ans = (ans * (tmp + 1)) % mod

print(ans)

Submission status: Accepted

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

MOD = 10**9 + 7
prime = [True] * (n+1)

p = 2
while p*p <= n:
    for i in range(p*2, n+1, p):
        prime[i] = False
    p += 1

allPrimes = []
for p in range(2, n+1):
    if prime[p]:
        allPrimes.append(p)

res = 1

for i in range(len(allPrimes)):
    p = allPrimes[i]
    #print(p)
    n_exp = 0
    while (p <= n):
        n_exp += n//p
        p *= allPrimes[i]

    res = (res * (n_exp + 1)) % MOD

print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# problem C2

## N! = 1 * 2 * ... * N
## N! = 2~e2 + 3~e3 + 5~e5 + ... + prime~eprime
## e2 = ord2(1) + ord2(2) + ... + ord2(N)
## ans = (e2 + 1)(e3 + 1)(e5 + 1)...
## e2 = [N/2] + [N/4] + [N/8] + [N/16] +...

from math import floor as gs
N = int(input())

## creating prime numbers until N
def fun_prime(k):
    counter = 0
    primes = [2, 3]

    for n in range(5, k+1, 2):
        isprime = True
        for i in range(1, len(primes)):
            if primes[i] ** 2 > n:
                break
            if n % primes[i] == 0:
                isprime = False
                break
        if isprime == True:
            primes.append(n)
    return(primes)
primes_N = fun_prime(N)

ans = 1
if N == 1:
    print(int(ans))
else:
    for prime in primes_N:
        e = 0
        power = prime
        while power <= N:
            e += gs(N/power)
            power = power * prime
        ans = ans * (e + 1)
    ans = ans % (10 ** 9 + 7)
    print(int(ans))

Submission status: Accepted

Solution code:
pr = [True] * 1001
n = int(input())
ans = 1
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if pr[i]:
        for j in range(i * 2, n + 1, i):
            pr[j] = False
        cnt = 0
        now = n
        while now:
            cnt += now // i
            now //= i
        ans = ans * (cnt + 1) % MOD
 
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

prime = []
table = [True] * (n + 1)

for i in range(2, n + 1):
    if not table[i]:
        continue
    k = i + i
    while k < n + 1:
        table[k] = False
        k += i

    prime.append(i)

ans = 1
for p in prime:
    k = 0
    for i in range(1, n + 1):
        v = i
        while v % p == 0:
            v //= p
            k += 1
    ans *= k + 1

print(ans % 1000000007)

Submission status: Accepted

Solution code:
from collections import defaultdict
from functools import reduce

P = 10**9 + 7

N = int(input())

rem = list(range(2, N+1))
dic = defaultdict(int)

while len(rem) > 0:
  n = rem[-1]
  for d in range(2, int(n**0.5) + 1):
    if n % d == 0:
      dic[d] += 1
      rem[-1] //= d
      break
  else:
    dic[n] += 1
    rem.pop()

print(reduce(lambda x, y: x*(y+1)%P, dic.values(), 1))

Submission status: Accepted

Solution code:
# import math
import collections

n = int(input())
# nf = math.factorial(n)
sosu = []

for i in range(1, n+1):
    if (2 ** i-1) % i == 1:
        sosu.append(i)

# print(sosu)
yakusu = collections.Counter()

for i in range(1, n+1):
    for j in sosu:
        if i < j:
            break
        elif i % j == 0:
            while i % j == 0 or i < 1:
                yakusu[j] += 1
                i = i / j


# print(yakusu)

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

Submission status: Accepted

Solution code:
import math
import collections

n = int(input())
nf = math.factorial(n)
sosu = []

for i in range(1, n+1):
    if (2 ** i-1) % i == 1:
        sosu.append(i)

# print(sosu)
yakusu = collections.Counter()

for i in range(1, n+1):
    for j in sosu:
        if i < j:
            break
        elif i % j == 0:
            while i % j == 0 or i < 1:
                yakusu[j] += 1
                i = i / j


# print(yakusu)

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

Submission status: Accepted

Solution code:
n = int(input())

prime = []
for i in range(2,1001):
	f = True
	for j in range(2,i):
		if i % j == 0:
			f = False
			break
	if f == True:
		prime.append(i)


c,total = 1,1

for p in prime:
	if p > n:
		continue
	for i in range(1,100):
		if p**i <= n:
			c += n // p**i
		else:
			total *= c
			c = 1
			break
		
print(total % (10**9+7))

Submission status: Accepted

Solution code:
import math

def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff

def divisor_num(n):
    a = 1
    for _ , x in factorization(n):
        a *= x + 1
    return a

n = int(raw_input())
nx = math.factorial(n)
print divisor_num(nx) % (10**9 + 7)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import collections

def factorial(n):
    a = 1
    for i in xrange(1, n + 1):
        a *= i
    return a

def prime_decomposition(n):
    i = 2
    counter = []
    while i < n:
        while n % i == 0:
            n /= i
            counter.append(i)
        i += 1

    if n > 1:
        counter.append(n)
    return counter

n = input()
a = factorial(n)

res = [v for v in collections.Counter(prime_decomposition(a)).values()]

divisor = 1
for i in res:
    divisor *= (1 + i)

print divisor % (10 ** 9 + 7)

Submission status: Accepted

Solution code:
n = int(input())

def primes(n):
	p_list = [2]
	for i in range(2, n+1):
		for p in p_list:
			if i%p == 0:
				break
		else:
			p_list.append(i)

	return p_list

p_list = primes(n)
x = [1]*len(p_list)

for j in range(1, 1+n):
	temp = j*1
	index = 0

	while temp > 1:
		if temp%p_list[index] == 0:
			temp = temp/p_list[index]
			x[index] += 1
		else:
			index += 1

count = 1
for n in x:
	count = (count*n)%(10**9+7)

print(int(count))

Submission status: Accepted

Solution code:

def add_facs(facsA, facsB):
	for fac in facsB:
		if fac in facsA:
			facsA[fac] += facsB[fac]
		else:
			facsA[fac] = facsB[fac]
	return facsA
	
def factorize(n_init):
	facs = {}
	n = n_init
	i = 2
	while (n > 1) and (i < n):
		if n%i == 0:
			add_facs(facs, factorize(i))
			n = n//i
		else:
			i += 1
			
	if (n == i):
		facs[n] = 1
		
	return facs
	

N = int(input())

perN = 1
for i in range(2,N+1):
	perN *= i
	
res_facs = factorize(perN)
num = 1
for fac in res_facs:
	num = num * (res_facs[fac] + 1)

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

Submission status: Accepted

Solution code:
N = int(input())

# get primes less than or equal to N
nums = list(range(2,N+1))
primes = []
while nums:
    p = nums.pop(0)
    nums = [x for x in nums if x % p]
    primes.append(p)

    
# factorize
factors_list = [[0] * len(primes), [0] * len(primes)]
for n in range(2, N+1):
    for i, p in enumerate(primes):
        div, mod = divmod(n, p)
        if mod == 0:
            fct = factors_list[div][:]
            fct[i] += 1
            factors_list.append(fct)
            break
            
# count divisors
factors_of_factorial = [sum(x) for x in zip(*factors_list)]
result = 1
for prod in factors_of_factorial:
    result *= prod+1
    result %= 1000000007
print(result)

Submission status: Accepted

Solution code:
import sys
import functools

mod = 1e9 + 7
n = int(input())
if n == 1:
    print(1)
    sys.exit()

fact = [1] * (n+1)

for i in range(2, n+1):
    for j in range(2, 32):
        if i == 0:
            break
        while True:
            if i % j == 0:
                i /= j
                fact[j] += 1
            else:
                break
    if i != 0:
        fact[int(i)] += 1

print(int(functools.reduce(lambda x, y: (x * y) % mod, fact[2:])))

Submission status: Accepted

Solution code:
N=int(input())
div=1000000007

primelist=list(range(2,N+1))

for i in range(2,N+1):
        j=2
        while i*j<=N:
                if i*j in primelist:
                        primelist.remove(i*j)
                j+=1

primecntdict={p:0 for p in primelist}

for n in range(2,N+1):
        for p in [p for p in primelist if p <= n]:
                while n%p==0:
                        n/=p
                        primecntdict[p]+=1

res=1
for p in primelist:
        res*=primecntdict[p]+1
        res%=div

print(res)

Submission status: Accepted

Solution code:
import math
N = int(raw_input())
count = [0 for i in xrange(N)]
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

for n in xrange(2,N+1):
  table = prime_decomposition(n)
  for t in table:
    count[t-2]+=1

C = 1
for c in count:
  if c!=0:
    C*=(c+1)
print C%1000000007

Submission status: Accepted

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

    primes = sieve(N+1)
    res = 1
    for p in primes:
        f = 0
        i = 1
        while p ** i <= N:
            f += (N//(p**i))
            i += 1
        res *= f + 1
        res = res % (10**9 + 7)

    print(res)

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i > 1]

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff


def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a

N = int(raw_input())

s = math.factorial(N)
x = divisor_num(s)
z = 1000000007

if x > z:
    ans = x%z
else:
    ans = x


print ans

Submission status: Accepted

Solution code:
import functools
import sys
import math
from functools import reduce

input = lambda :sys.stdin.readline()
@functools.lru_cache(maxsize=10000)

def prime_numbers(limit=50001):
    yield 2
    sub_limit = int(limit**0.5)
    flags = [True, True] + [False] * (limit - 2)
    for i in range(3, limit, 2):
        if flags[i]:
            continue
        yield i

        if i <= sub_limit:
            for j in range(i*i, limit, i<<1):
                flags[j] = True

p=list(prime_numbers())


n=int(input())
d=[]
pr=1
for num in p:
    if num<=n:
        exp=1
        s=0
        while n>=num**exp:
            s+=int(n/(num**exp))
            exp+=1
        pr*=(s+1)
        # d.append(s)
    else:
        break
print (pr%1000000007)

Submission status: Accepted

Solution code:
N=int(input())
div=1000000007

primedict= {i:True for i in range(2,N+1)}

for i in range(2,N+1):
        if primedict[i]==True:
                j=2
                while i*j<=N:
                        primedict[i*j]=False
                        j+=1

primelist = [i for i in  range(2,N+1) if primedict[i]==True]

primecntdict={p:0 for p in primelist}

for n in range(2,N+1):
        for p in [p for p in primelist if p <= n]:
                while n%p==0:
                        n/=p
                        primecntdict[p]+=1

res=1
for p in primelist:
        res*=primecntdict[p]+1
        res%=div

print(res)

Submission status: Accepted

Solution code:
from collections import Counter
def primes(n):
    pp = [True] * (n+1000)
    pp[0] = False
    pp[1] = False

    for i in range(2,n+1000):
        if pp[i]:
            for j in range(2,(n+1000)//i):
                pp[i*j] = False
    result = [i for i in range(n+1) if pp[i]]
    return result



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

    pr = primes(N)
    counter = Counter()
    for p in pr:
        x = p
        while x <= N:
            counter[p] += N//x
            x *= p
    result = 1
    for x in counter.values():
        result = (result * (x+1)) % 1000000007
    print(result)

Submission status: Accepted

Solution code:
import sys
import math

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

factor = {}

for n in range(2, N + 1):
    p = 2
    root_n = math.sqrt(n)

    while n > 1 and p <= root_n:
        if n % p == 0:
            if p not in factor:
                factor[p] = 0

            while n % p == 0:
                n //= p
                factor[p] += 1

        p += 1

    if n > 1:
        if n not in factor:
            factor[n] = 1
        else:
            factor[n] += 1

# print(factor)

ans = 1

for v in factor.values():
    ans *= (v + 1)

ans %= M

print(ans)

Submission status: Accepted

Solution code:
def SieveOfEratosthenes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):

        if (prime[p] == True):

            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    lis = []
    for i in range(2,n+1):
        if prime[i]:
            lis.append(i)
    return lis

n = int(input())

lis1 = []

l = SieveOfEratosthenes(n)

for i in l:
    m = n
    z = i
    exp = 0
    while(m>=z):
        exp += m//z
        z*=i
    lis1.append(exp)

mul = 1
for i in lis1:
    mul *= (i+1)

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

Submission status: Accepted

Solution code:
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
N = input()
ans = 1
nlist = [0]*1000
for i in xrange(1,N+1):
    for j in prime_decomposition(i):
        nlist[j-1] += 1

for j in nlist:
    ans *= (j+1)

print ans%1000000007

Submission status: Accepted

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


def read():
    return input()


def work(N):
    divisor2cnt = {}
    for i in range(1, N + 1):
        num = i
        divisor = 2
        
        while divisor * divisor <= num:
            while num % divisor == 0:
                num /= divisor
                if divisor not in divisor2cnt:
                    divisor2cnt[divisor] = 1
                else:
                    divisor2cnt[divisor] = divisor2cnt[divisor] + 1
            divisor += 1
        
        if num != 1:
            if num not in divisor2cnt:
                divisor2cnt[num] = 1
            else:
                divisor2cnt[num] = divisor2cnt[num] + 1

    ans = 1
    for (divisor, cnt) in divisor2cnt.items():
        ans = ans * (cnt + 1) % 1000000007
    print ans


if __name__ == "__main__":
    work(read())

Submission status: Runtime Error

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

N = int(input())

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

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

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

print(acc)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
p=[1 for i in range(10000)]
p[0]=0
p[1]=0
for i in range(2,n+1):
  if p[i]==1:
  	for j in range(i*i,n+1,i):
      p[j]=0
ans=1
for i in range(2,n+1):
  if p[i]:
    c=0
    k=i
    while n//k>0:
      c=c+(n//k)%m
      k=k*k
    ans=(ans*((c+1)%m))%m
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
p=[0 for i in range(10000)]
p[0]=0
p[1]=0
for i in range(2,n+1):
  if p[i]==1:
  	for j in range(i*i,n+1,i):
      p[j]=0
ans=1
for i in range(2,n+1):
  if p[i]:
    c=0
    k=i
    while n//k>0:
      c=c+(n//k)%m
      k=k*k
    ans=(ans*((c+1)%m))%m
print(ans)

Submission status: Runtime Error

Solution code:
from math import sqrt

num = int(input())
f = 1

for i in range(num):
  f = f * (i+1)
  
divisors = 0
new_f = f%1000000007
for i in range(sqrt(new_f)):
  if new_f%(i+1) == 0:
    divisors += 2
    
print(divisors)

Submission status: Runtime Error

Solution code:
num = int(input())
product = 1
factors = 0

for i in range(1, num+1):
  product *= i
  
for j in range(1, product/2 + 1):
  if product % j == 0:
    factors += 1
print(factors)

Submission status: Runtime Error

Solution code:
from math import sqrt

num = int(input())
f = 1

for i in range(num):
  f = f * (i+1)
  
divisors = 0
  
for i in range(int(sqrt(f))):
  if f%(i+1) == 0:
    divisors += 2
    
print(divisors)

Submission status: Runtime Error

Solution code:
num = int(input())
product = 1
factors = 0

for i in range(1, num+1):
  product *= i
  
for j in range(product//2):
  if product % j == 0:
    factors += 1
print(factors)

Submission status: Runtime Error

Solution code:
num = int(input())
total = 0
for i in range(1, num+1):
  fac *= i
for i in range(1, fac+1):
  if(fac % i == 0):
    total += 1
print(total)

Submission status: Runtime Error

Solution code:
num = int(input())
i = 1
total = 0
for i in range(1, num+1):
  fac *= i
for i in range(1, fac+1):
  if(fac % i == 0):
    total += 1
print(total)

Submission status: Runtime Error

Solution code:
num = int(input())
f = 1

for i in range(num):
  f = f *(i+1)
divisors = 0
  
for i in range(f):
  if f%i == 0:
    divisors += 1
    
print(divisors)

Submission status: Runtime Error

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

def primeryNum(n):
    n_=int(n**0.5)
    ary=list(range(n+1))
    ary[1]=0 
    for a in ary:
        if a>n_: break
        elif a==0: continue
        
        for i in range(a*2,n+1,a):
            ary[i]=0           
    return ary

primeryN=primeryNum(N)
divN=[0]*N
for pn in primeryN:
    if pn==0:
        continue
    i=1
    cnt=0
    while (pn**i<N):
        cnt+=(N//pn**i)
        i+=1
    divN[pn]=cnt

ans=1
for d in divN:
    if d==0:
        continue
    ans=(ans*(d+1))%p
print(ans)

Submission status: Runtime Error

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

for i in range(1,n+1):
    t *= i
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(t))
ans = 1
for _, v in c.items():
    ans *= (v + 1)
print(ans%(10**9+7))

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

n = int(input())
m = factorial(n)
res = make_divisors(m)
print(len(res)%(10**9+7))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
prime_list = []
    #2からnまでの数字をsearch_listに入れる
search_list = list(range(2,n+1))
while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(n):
        #prime_listにsearch_listを結合
          prime_list.extend(search_list)
          break
      else:
        #search_listの先頭をprime_listに入れる
          head_num = search_list[0]
          prime_list.append(head_num)
        #search_listの先頭をpopする
          search_list.pop(0)
        #head_numの倍数を取り除く
          search_list = [num for num in search_list if num % head_num != 0]
#print(prime_list)
########ここから本問を解く#########
ans = 1
for x in prime_list:
  tmp = 0
  nl = 1
  while(x**nl <= n):
    tmp += n//(x**nl)
    nl += 1
  ans *= tmp+1
if ans >= 10**9+7:
  ans %= (10**9+7)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
num = int(input())
print(sympy.divisor_count(math.factorial(num)) % (10**9+7))

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i in range(1, n):
  a *= i
li = []
temp = 0
while a % 2 == 0:
  temp += 1
  a //= 2
else:
  li.append(temp+1)
for i in range(3, int(a**0.5)+1, 2):
  temp = 0
  while a % i == 0:
    temp += 1
    a //= i
  else:
    li.append(temp+1)
ans = 1
for i in li:
  ans *= i
else:
  print(ans)