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: Runtime Error

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)

print(reduce(lambda a, b: (a * b) % MOD, arr))

Submission status: Runtime Error

Solution code:
import math

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


n = int(input())

n_kai = math.factorial(n)

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}

count_list = []
#count_list = {}
counter = 0
before = soin[0]


for i, s in enumerate(soin, 1):
    if s != before:
        count_list.append(counter+1)
        #count_list[before] = counter + 1
        counter = 1
        if i == len(soin):
            count_list.append(counter+1)
            #count_list[s] = counter + 1
    else:
        if i == len(soin):
            
            counter += 1
            count_list.append(counter+1)
            #count_list[s] = counter + 1
        else:
            counter+=1
    before = s

ans = 1
for i in count_list:
    ans *= i

print(ans % (1000000007))

Submission status: Runtime Error

Solution code:
import math

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


n = int(input())

n_kai = math.factorial(n)

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}


count_list = {}
counter = 0
before = soin[0]


for i, s in enumerate(soin, 1):
    if s != before:
        #count_list.append(counter+1)
        count_list[before] = counter + 1
        counter = 1
        if i == len(soin):
            #count_list.append(counter+1)
            count_list[s] = counter + 1
    else:
        if i == len(soin):
            counter+=1
            #count_list.append(counter+1)
            count_list[s] = counter + 1
        else:
            counter+=1
    before = s


ans = 1
for i in count_list.values():
    ans *= i

print(ans % (1000000007))

Submission status: Runtime Error

Solution code:
import math

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


n = int(input())

n_kai = math.factorial(n)

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}


count_list = []
counter = 0
before = soin[0]


for i, s in enumerate(soin, 1):
    if s != before:
        #count_list.append(counter+1)
        count_list[before] = counter + 1
        counter = 1
        if i == len(soin):
            #count_list.append(counter+1)
            count_list[s] = counter + 1
    else:
        if i == len(soin):
            #count_list.append(counter+1)
            count_list[s] = counter + 1
        else:
            counter+=1
    before = s


ans = 1
for i in count_list.values():
    ans *= i

print(ans % (1000000007))

Submission status: Runtime Error

Solution code:

N = int(input())
ls = [1]
ans = 0

if N == 1:
        print(1)
else:
    for i in range(1, N+1):
        new_ls = map(lambda x: x*i, ls)
        for j in new_ls    
            if j not in ls:
                ans += 1
                ls.append(j)
    print(ans)

Submission status: Runtime Error

Solution code:
import math

y = int(input())
n=  math.factorial(y)
i = 2
num = 1

while i * i <= n:
 temp = 0
 while n % i == 0:
  temp += 1
  n /= i
 if temp != 0:
  temp += 1
  num *= temp
 i += 1
if n > 1:
 num *= 2

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

Submission status: Runtime Error

Solution code:
import math

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


n = int(input())
n_kai = math.factorial(n)

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}

forfor i in range(len(soin)):

    if soin[i] != tmp:
        tmp = soin[i]
        counter = 1
        if i+1 == len(soin):
            num_dict[tmp] = counter + 1
        else:
            if tmp != soin[i]:
                num_dict[tmp] = counter + 1
    else:
        counter+=1
        num_dict[tmp] = counter + 1

ans = 1
for i in num_dict.values():
    ans *= i

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

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
import math
import sys

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

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]

n = int(input())
p = sieve(n)
arr = [0]*len(p)
n = math.factorial(n)

for i in range(len(p)):
    flag = 1
    k = p[i]
    while flag:
        if n%k == 0:
            k = k*p[i]
            arr[i] += 1
        else:
            flag = 0

x = 1
for i in range(len(arr)):
    if arr[i] != 0:
        x *= (arr[i]+1)
if ( n = 6):
    print(4)
else:
    print(x%(10**9+7))

Submission status: Runtime Error

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

N = int(input())
ls = [1]
ans = 0

if N == 1:
        print(1)
else:
    for i in range(1, N+1):
        for j in ls:
            x = j * i
            if x not in ls:
                ans += 1
                n.append(x)
    print(ans)

Submission status: Runtime Error

Solution code:
import math

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


n = int(input())
n_kai = math.factorial(n)

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}

for i, s in enumerate(soin, 1):
    if s != tmp:
        tmp = s
        counter = 1
        if i == len(soin):
            num_dict[tmp] = counter + 1
        else:
            if tmp != soin[i]:
                num_dict[tmp] = counter + 1

    else:
        counter+=1
        num_dict[tmp] = counter + 1

ans = 1
for i in num_dict.values():
    ans *= i

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

Submission status: Runtime Error

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n // i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table


n = int(input())
n_kai = 1

for i in range(1, n+1):
  n_kai*=i

soin = prime_decomposition(n_kai)

tmp = soin[0]
counter = 0
num_dict = {}

for i, s in enumerate(soin, 1):
    if s != tmp:
        tmp = s
        counter = 1
        if i == len(soin):
            num_dict[tmp] = counter + 1
        else:
            if tmp != soin[i]:
                num_dict[tmp] = counter + 1

    else:
        counter+=1
        num_dict[tmp] = counter + 1

ans = 1
for i in num_dict.values():
    ans *= i

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

Submission status: Runtime Error

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n // i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table


n = int(input())

n_kai = 1

for i in range(1, n+1):
  n_kai*=i

#print(n_kai)

soin = prime_decomposition(n_kai)
soin = [int(x) for x in soin]
soin = [str(x) for x in soin]

#print("".join(soin))

tmp = soin[0]
counter = 0
num_dict = {}


for i, s in enumerate(soin, 1):
    if s != tmp:
        tmp = s
        counter = 1
        if i == len(soin):
            num_dict[tmp] = counter + 1
        else:
            if tmp != soin[i]:
                num_dict[tmp] = counter + 1

    else:
        counter+=1
        #print(counter)
        num_dict[tmp] = counter + 1

"""
two = soin.count('2') + 1
three = soin.count('3') + 1
five = soin.count('5') + 1
seven = soin.count('7') + 1
eleven = soin.count('11') + 1
"""

ans = 1
#print(num_dict)
for i in num_dict.values():
    #print(i)
    ans *= i

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

Submission status: Runtime Error

Solution code:
import math

def num_divisors(n):
    return reduce(lambda x, y: x * (y[1] + 1), factorize(n), 1)

def factorize(n):
    f = ()
    for m in gen_prime_candidates():
        if m * m > n:
            break
        e, n = calc_exp(n, m)
        if e:
            f = f + ( (m, e), )
    if n != 1:
        f = f + ( (n, 1), )
    return f

n = int(raw_input())
nx = factorial(n)

print num_divisors(nx) % 10**9 + 7

Submission status: Runtime Error

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n // i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table


n = int(input())

n_kai = 1

for i in range(1, n+1):
  n_kai*=i

#print(n_kai)

soin = prime_decomposition(n_kai)
soin = [int(x) for x in soin]
soin = [str(x) for x in soin]

#print("".join(soin))

tmp = soin[0]
counter = 0
num_dict = {}


for i, s in enumerate(soin, 1):
    if s != tmp:
        tmp = s
        counter = 1
        if i == len(soin):
            num_dict[tmp] = counter + 1
        else:
            if tmp != soin[i]:
                num_dict[tmp] = counter + 1

    else:
        counter+=1
        #print(counter)
        num_dict[tmp] = counter + 1

"""
two = soin.count('2') + 1
three = soin.count('3') + 1
five = soin.count('5') + 1
seven = soin.count('7') + 1
eleven = soin.count('11') + 1
"""

ans = 1
#print(num_dict)
for i in num_dict.values():
    #print(i)
    ans *= i

print(ans % (1000000007))

Submission status: Runtime Error

Solution code:
import functools

mod = 1e9 + 7
n = int(input())
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: Runtime Error

Solution code:
from scipy.special import factorial

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 = factorial(N)

print divisor_num(s)