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:
l =    [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]
ans = 1
n = int(input())
for i in l:
  temp = n
  c = 1
  while temp >= i:
    temp //= i
    c += temp
  ans *= c
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
mod = 10 ** 9 + 7

n = int(input())

e = [0] * (10 ** 3 + 1)
for x in range(1, n + 1):
    div = 2
    cnt = 0
    while x % div == 0:
        x //= div
        cnt += 1
    if cnt > 0:
        e[div] += cnt

    for div in range(3, int(n ** 0.5) + 1, 2):
        cnt = 0
        while x % div == 0:
            x //= div
            cnt += 1
        if cnt > 0:
            e[div] += cnt

    if x > 1:
        e[x] += 1

ans = 1
for cnt in e:
    if cnt > 0:
        ans = (ans * (cnt + 1)) % mod
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N = math.factorial(int(input()))
    i = 2
    ans = 1
    while i * i < N:
        cnt = 1
        while N % i == 0:
            cnt += 1
            N //= i
        ans *= cnt
        i += 1
    if N != 1:
        ans *= 2

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections

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

MOD = 10**9+7

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

F = []
for i in range(2,N+1):
  F[len(F):len(F)] = prime_factorize(i)
#print(F)
c = collections.Counter(F)
#print(c)
ans = 1
for v in c.values():
  ans *= v+1
  ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
d=defaultdict(int)
n=int(input())
def prime(n):
  if n==2:
    return True
  if n==3:
    return True
  for i in range(2,int((n)**(1/2))+1):
    if n%i==0:
      return False
  return True
plist=[]
for i in range(2,n+1):
  if prime(i):
    plist.append(i)
for i in range(1,1+n):
  num=i
  for j in plist:
    countp=0
    while num%j==0:
      num=num//j
      countp+=1
    d[j]+=countp
ans=1
for i in d:
  ans=(ans*(d[i]+1))%(10**9+7)
print(ans)

Submission status: Accepted

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

def bunkai(n):
  a=[]
  while n%2==0:
    n//=2
    a.append(2)
  f=3
  while f*f<=n:
    if n%f==0:
      n//=f
      a.append(f)
    else:
      f+=2
  if n!=1:
    a.append(n)
  return(collections.Counter(a))
  
l=collections.Counter()
for n in range(1,N+1):
  l+=bunkai(n)
  
ans=1
for i in l.values():
  ans=(ans*(i+1)%mod)%mod
  
print(ans)

Submission status: Accepted

Solution code:
import sys
import math

def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    Q = [0 for k in range(N+1)]
    for M in range(1,N+1):
        k = 2
        while k*k <= M:
            if M%k == 0:
                M //= k
                Q[k] += 1
            else:
                k += 1
        if M > 1:
            Q[M] += 1
    ans = 1
    for k in range(N+1):
        ans *= Q[k]+1
        ans %= 10**9 + 7
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict

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

def primeCount(N):
    R = int(N**(0.5)) + 1  # 素数の範囲
    primes = {}  # 素数のリスト
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1 :
        primes[n] = 1
    return { key : val for key, val in primes.items() if val > 0}  # フィルターをかける

primes = defaultdict(int)
for i in range(1, N + 1):
    ps = primeCount(i)
    for p, c in ps.items():
        primes[p] += c

ans = 1
for c in primes.values():
    ans *= (c + 1)
    ans %= MOD

print(ans % MOD)

Submission status: Accepted

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

from collections import Counter
def factorize(n):
    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

factors = Counter()
for n in range(1,N+1):
    factors += factorize(n)

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

# 素因数分解
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

def main():
    N = int(input())
    # N! の約数の個数は N! の素因数がわかれば計算できる
    # ⇒ 1 ~ N の素因数を計算して、辞書を使って数えていく
    d = dict()
    for n in range(1, N+1):
        for p in prime_factorize(n):
            if p in d:
                d[p] += 1
            else:
                d[p] = 1
    ans = 1
    for i in d.values():
        ans *= (i+1)
        ans %= (10**9+7)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    d = collections.defaultdict(int)
    for i in range(1, n + 1):
        t = i
        for j in range(2, i + 1):
            while True:
                if t % j == 0:
                    d[j] += 1
                    t //= j
                else:
                    break
    t = 1
    for k, v in d.items():
        t = t * (v + 1) % (10 ** 9 + 7)
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
from collections import defaultdict

def main():
    n=int(input())
    mod=10**9+7
    ans=1
    l=[]
    d=defaultdict(int)
    for i in range(1,n+1):
        l+=prime_factorize(i)
    for i in l:
        d[i]+=1
    for i in d.values():
        ans*=i+1
    print(ans%mod)


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

nf = math.factorial(n)

dic = {}
for i in range(2, nf + 1):
  counter = 0
  while nf % i == 0:
    nf //= i
    counter += 1
  if counter != 0:
    dic[i] = counter
  if nf == 1:
    break
ans = 1
for item in dic.values():
  ans *= (item + 1) % (10**9 + 7)
print(ans % (10**9 + 7))

Submission status: Accepted

Solution code:
N=int(input());d={};p=1
for i in range(1,1+N):
 f=2
 while f*f<=i:
  if i%f:f+=1
  else:d[f]=d.get(f,0)+1;i//=f
 if i>1:d[i]=d.get(i,0)+1
for v in d.values():p*=v+1
print(p%(10**9+7))

Submission status: Accepted

Solution code:
def PrimeNumber(N):
    if N==2:
        ans=[2]
        return ans
    ans = list(range(2, N + 1))
    i = 0
    while ans[i] < N ** 0.5 + 1:
        j = 2
        temp = ans[i]
        while temp * j <= ans[-1]:
            if temp * j in ans:
                ans.remove(temp * j)
            j += 1
        i += 1
    return ans

N=int(input())

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

mod=10**9+7
PN=PrimeNumber(N)
P=[0]*(N+1)

for i in range(2,N+1):
    temp=i
    for j in PN:
        if temp<j:
            break
        cnt=0
        while temp%j==0:
            cnt+=1
            temp=temp//j
        P[j]+=cnt

ans=1

for i in range(1,N+1):
    if P[i]!=0:
        ans=(ans*(P[i]+1))%mod
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict


def PrimeFactorization(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        pf[m] = 1
    return pf


def main():
    n = int(input())
    d = defaultdict(int)
    for i in range(n + 1):
        for k, v in PrimeFactorization(i).items():
            d[k] += v
    ans = 1
    for v in d.values():
        ans *= (v + 1)
        ans %= 1000000007
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections
N = int(input())
ans = 0
ans_table = collections.defaultdict(int)
prev = []
for i in range(1, N+1):

    tmp = i
    for j in range(2, int((i**0.5//1))+1):
        if tmp % j == 0:
            count = 0
            while tmp % j == 0:
                count += 1
                tmp = tmp//j
            ans_table[j] += count
    if tmp != 1:
        ans_table[tmp] += 1

ans_list = list(ans_table.values())
ans = 1
for x in ans_list:
    ans *= (x+1)

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

Submission status: Accepted

Solution code:
n = int(input())
if n < 3:
    print(n)
    exit()

primes = [2]

import math
for i in range(3, n+1):
    k = int(math.sqrt(i))
    flag = True
    for p in primes:
        if p > k:
            break
        if  i%p == 0:
            flag = False
            break
    if flag:
        primes.append(i)

ans = 1
for p in primes:
    k = n
    cnt = 0
    while k:
        k = k//p
        cnt += k
    # print(p, cnt)
    ans *= cnt + 1
ans = ans % (10**9 + 7)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
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]
res = 1

nprime = [p for p in prime if p <= n]

for p in prime:
    tempn = n
    tres = 1
    while tempn >= p:
        tempn = tempn // p
        tres += tempn
    res *= tres
    if res > 10**9+7:
        res %= (10**9+7)

print(res)

Submission status: Accepted

Solution code:
N=int(input())
M=[0]*1001

for i in range(2,N+1):
  j=2
  ii=i
  while 1:
    #print(ii)
    if ii%j==0:
      M[j]+=1
      ii//=j
      j=2
    else:
      j+=1
    if ii==1:
      #print("")
      break
#print(M[:10])

ans=1
for m in M:
  if m:
    ans*=(m+1)
print(ans%(10**9+7))

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
MOD = 10**9+7
  
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
  
ans = 1
counter = Counter()
for p in range(2,N+1):
  counter.update(Counter(prime_factorize(p)))
for value in counter.values():
    ans *= (value + 1)
print(ans % MOD)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def prime(n,is_prime=True):
    """
    n: positive integer
    if is_prime: return n is prime
    else: return list of prime <= n
    """
    if n<=1: return False if is_prime else []
    S=[1]*(n+1)
    S[0]=0; S[1]=0
    for i in range(2,n):
        if S[i]==0: continue
        for j in range(2*i,n+1,i):
            S[j]=0
    if is_prime: return bool(S[n])
    else: return [p for p in range(n+1) if S[p]]
def resolve():
    n=int(input())
    P=prime(n,False)
    bin=[0]*(n+1)
    for p in P:
        q=p
        while(q<=n):
            bin[p]+=n//q
            q*=p
    ans=1
    for b in bin:
        ans=ans*(b+1)%MOD
    print(ans)
resolve()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
all=1
ans=1
l=[1]*(N+1)

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

Submission status: Accepted

Solution code:
from collections import Counter

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 = int(input())

t = []
for tmp in range(2, n+1):
    t.extend(prime_decomposition(tmp))

ans = 1

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


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

Submission status: Accepted

Solution code:
from math import factorial
from functools import reduce
from operator import mul

N = factorial(int(input()))
if N == 1:
  print(1)
  exit()

M = 10**9 + 7
ans = 1

div = 2
while N != 1:
  cnt = 0
  while N%div == 0:
    N //= div
    cnt += 1
  if cnt != 0:
    ans *= (cnt+1)
    ans = ans%M
  div += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())

pf = []

for i in range(2, n+1):
    f = i
    cnt = 2
    while True:
        if not f % cnt:
            pf.append(cnt)
            f //= cnt
            if f == 1: break
        else: cnt += 1
          
c = Counter(pf)
ans = 1
for v in c.values():
    ans *= v+1

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

Submission status: Accepted

Solution code:
l=[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())
a=1
for x in l:
	a*=sum(n//x**i for i in range(1,2+9*(x<32)))+1
	a%=10**9+7
print(a)

Submission status: Accepted

Solution code:
n=int(input());a=1;r=range
for x in[i for i in r(2,n+1)if all(i%j for j in r(2,int(i**.5)+1))]:a*=sum(n//x**i for i in r(1,11))+1;a%=10**9+7
print(a)

Submission status: Accepted

Solution code:
n=int(input());a=1;r=range
for x in[i for i in r(2,n+1)if all(i%j for j in r(2,i))]:a*=sum(n//x**i for i in r(1,11))+1
print(a%(10**9+7))

Submission status: Accepted

Solution code:
N = int(input())


def trial_division(n):
    factor = []
    for num in range(2, int(n**0.5)+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor or n != 1:
        factor.append(n)
    return factor


d = {}
for i in range(2, N+1):
    divisors = trial_division(i)
    for divisor in divisors:
        d[divisor] = d.get(divisor, 0) + 1

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

Submission status: Accepted

Solution code:
from collections import Counter

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

N = int(input())
counter = Counter()
for i in range(2, N+1):
    counter.update(Counter(prime_factorize(i)))
ans = 1
for value in counter.values():
    ans *= (value + 1)
print(ans % (10**9 + 7))

Submission status: Accepted

Solution code:
N = int(input())
memo = [0] * (N + 1)

def factor(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n //= i
                cnt += 1
            memo[i] += cnt
        i += 1
    if n > 1:
        memo[n] += 1

for n in range(2, N + 1):
    factor(n)

mod = 10 ** 9 + 7
ans = 1
for m in memo:
    if m >= 1:
        ans *= m + 1
        ans %= mod
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
A = list(range(2,N+1))
sqrt = N**(1/2)
idx = 0
if N == 1:
    print(1)
    exit()
while True:
    p = A[idx]
    if p > sqrt:
        break
    check_numbers = A[idx+1:]
    for check_number in check_numbers:
        if check_number % p == 0:
            A.remove(check_number)
    idx += 1

ans = 1
B = [1] * 1001
for n in range(2, N+1):
    for a in A:
        if n == 1:
            break
        while True:
            if n % a == 0:
                B[a] += 1
                n //= a
            else:
                break
MOD = 10**9+7
print(reduce(lambda a,b: a*b , B)%MOD)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if(n%i==0):
            divisors.append(i)
            divisors.append(n//i)
    return divisors
    
def factorization(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
    
def main():
    n=int(input())
    ans=1
    cnt={}
    for i in range(1,n+1):
        fact=factorization(i)
        for s in fact:
            if s not in cnt:
                cnt[s]=1
            else:
                cnt[s]+=1
    for value in cnt.values():
        ans=ans*(value+1)%(10**9+7)
    print(ans)
main()

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
prime = []
for n in range(2, N+1):
    cnt = 0
    for i in range(1, n+1):
        if n % i == 0:
            cnt += 1
    if cnt == 2:
        prime.append(n)

ans = 1
for p in prime:
    cnt = 0
    for n in range(1, N + 1):
        # p で何回割り切れるか
        tmp = n
        while n / p == n // p:
            cnt += 1
            n //= p
    ans *= (cnt + 1)
    ans %= MOD

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import factorial
from collections import Counter

def prime(n):
    a = [0] * (n + 1)
    a[0] = 1
    a[1] = 1
    i = 2
    while n // i >= i:
        if a[i] != 0:
            i += 1
            continue
        j = 2 * i
        while j <= n:
            a[j] = 1
            j += i
        i += 1
    return [i for i, ai in enumerate(a) if ai == 0]


n = int(input())
f = factorial(n)
primes = prime(n)
counter = Counter()

while f > 1:
    for p in primes:
        if f % p == 0:
            counter[p] += 1
            f = f // p

ans = 1
for val in counter.values():
    ans *= (val + 1)

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

Submission status: Accepted

Solution code:
from math import factorial
from collections import Counter

def primes(n):
    a = [0] * (n + 1)
    a[0] = 1
    a[1] = 1
    i = 2
    while n // i >= i:
        if a[i] != 0:
            i += 1
            continue
        j = 2 * i
        while j <= n:
            a[j] = 1
            j += i
        i += 1
    for i, ai in enumerate(a):
        if ai == 0:
            yield i


n = int(input())
f = factorial(n)
counter = Counter()

while f > 1:
    for p in primes(n):
        if f % p == 0:
            counter[p] += 1
            f = f // p

ans = 1
for val in counter.values():
    ans *= (val + 1)

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

Submission status: Accepted

Solution code:
from collections import defaultdict

#[[素因数,数]]を出力
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f

#n以下の素数列挙(O(n log(n))
def primes(n):
    ass = []
    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
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

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

for i in range(1,n+1):
	for item in fctr1(i):
	    dd[item[0]] += item[1]

res=1

for item in dd.values():
  res=(res*(item+1))%mod
print(res)

Submission status: Accepted

Solution code:
import math
import collections


def sosu(N):
    res = [0] * (N + 1)
    res[0] = res[1] = 1
    for i in range(2, math.ceil((math.sqrt(N)) + 1)):
        if res[i] != 0: continue
        for j in range(2, N):
            if i * j > N: break
            res[i * j] = 1
    return [i for (i, v) in enumerate(res) if v == 0]


N = int(input())
p_tbl = sosu(N)

counter = collections.Counter()
for i in range(2, N + 1):
    tmp = i
    for p in p_tbl:
        while tmp % p == 0 and tmp // p > 0:
            counter[p] += 1
            tmp = tmp // p
ans = 1
for v in counter.values():
    ans *= (v + 1)
    ans %= (10**9)+7
print(ans)

Submission status: Accepted

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

MOD = (10 ** 9) + 7

def factorization(n):
    x = 2
    pw = 0
    factlist = []
    while(n != 1):
        if(n%x == 0):
            n = n // x
            pw += 1
        elif(pw > 0):
            factlist.append([x,pw])
            pw = 0
            x += 1
        else:
            x += 1
    factlist.append([x,pw])
    return factlist


list = factorization(math.factorial(N))
ans = 1
for i in range(len(list)):
    ans = ((ans % MOD) * ( (list[i][1] + 1) % MOD)) % MOD
print(ans)

Submission status: Accepted

Solution code:
import math
mod = 10 ** 9 + 7

def f(num):

    i = 2
    d = dict()

    while i * i <= num:
        if num % i == 0:
            num //= i
            d[i] = d.get(i, 0) + 1
        else:
            i += 1
    d[num] = 1

    return d

n = int(input())
if n == 1:
    print(1)
    exit()

ans = 1

for i in f(math.factorial(n)).values():
    ans *= i+1

print(ans%mod)

Submission status: Accepted

Solution code:
import math
import collections

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

n = int(input())
mod = 10 ** 9 + 7
f = factorizec(math.factorial(n))
ans = 1
for i in f:
    ans *= i[1] + 1
print(ans % mod)

Submission status: Accepted

Solution code:
n=int(input())
sosu=[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]
a=[0]*len(sosu)
for i in range(2,n+1):
	for j in range(len(sosu)):
		while i%sosu[j]==0:
			i//=sosu[j]
			a[j]+=1
ans=1
for i in range(len(sosu)):
	ans*=(a[i]+1)
	ans%=(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
d = [0] * n
for i in range(2, n + 1):
    ti = i
    for j in range(2, n + 1):
        while True:
            if ti % j == 0:
                d[j-1] += 1
                ti //= j
            else:
                break
t = 1
for i in d:
    t = t * (i + 1) % (10 ** 9 + 7)
print(t)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    MOD = int(1e9) + 7
    if N == 1:
        print(1)
        exit()
    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]
    count = [0] * len(primes)
    for i in range(2, N+1):
        for j in range(len(primes)):
            while i%primes[j] == 0:
                count[j] += 1
                i //=primes[j]
    # print(count)
    ans = 1
    for i in range(len(count)):
        if count[i] > 0:
            ans *= count[i]+1
            ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
d = defaultdict(int)


def soinsuu(n):
    while n != 1:
        for i in range(2, int(n**0.5)+1):
            if n % i == 0:
                d[i] += 1
                n = n // i
                break
        else:
            d[n] += 1
            n = 1


for i in range(1, N+1):
    soinsuu(i)
ans = 1
for v in d.values():
    ans = ans * (v+1) % int(1e9+7)
print(ans)

Submission status: Accepted

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

N = int(input())
#print(factorize(N))

check = [0] * 10001
for i in range(1, N+1):
    tmp = factorize(i)
    for j in range(len(tmp)):
        check[tmp[j][0]] += tmp[j][1]

x = []
for i in range(len(check)):
    if check[i] != 0:
        x.append(check[i])
#print(x)

ans = 1
for i in range(len(x)):
    ans *= x[i]+1 
    ans %= 1000000007
print(ans)

Submission status: Accepted

Solution code:
# 2019/08/12
from math import factorial

n=int(input())
mod=(10**9+7)
def trial_div(n):
    div={}
    for i in range(2,n+1):
        res=i
        for j in range(2,i+1):
            while res%j==0:
                res//=j
                div[j]=div.get(j,0)+1
    return div

res=trial_div(n)
ans=1
for k,v in res.items():
    ans=(ans*(v+1))%mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def prime(N):
    L = [2]
    for i in range(2, N+1):
        for l in L:
            if i % l == 0:
                break
        else:
            L.append(i)
    return L

def factor(N):
    p = []
    for l in prime(N):
        while(N % l == 0):
            p.append(l)
            N //= l
    return p
L = []
for i in range(2, N+1):
    L += factor(i)
ans = 1
for p in prime(N):
    l = L.count(p)
    ans *= (l+1)
    ans %= 10**9+7
print(ans)

Submission status: Accepted

Solution code:
z = int(input())
a = [True] * 1001
a[0] = False
a[1] = False
b = []
for i in range(2, 1001):
    if a[i]:
        b.append(i)
        for j in range(i, 1001, i):
            a[j] = False
c = {}
for i in range(1, z + 1):
    d = i
    while True:
        if d == 1:
            break
        else:
            while d != 1:
                for j in b:
                    if d % j == 0:
                        d //= j
                        if j not in c:
                            c[j] = 1
                        else:
                            c[j] += 1
e = 1
for v in c.values():
    e = (e * (v + 1)) % (10 ** 9 + 7)
print(e)

Submission status: Accepted

Solution code:
a = [True] * 1001
a[0] = False
a[1] = False
b = []
c = {}
for i in range(2, 1001):
    if a[i]:
        b.append(i)
        for j in range(2, 1001, 2):
            a[j] = False
d = int(input())
for j in range(2, d + 1):
    temp_j = j
    for i in b:
        while True:
            if temp_j % i != 0:
                break
            else:
                if i not in c:
                    c[i] = 1
                else:
                    c[i] += 1
                temp_j //= i
e = 1
for k in c.keys():
    e = (e * (c[k] + 1)) % (10 ** 9 + 7)
print(e)

Submission status: Accepted

Solution code:
import collections

factors = [[],[1]]
for i in range(2,1001):
    temp = []
    div = 2
    while div <= i and 1 < i:
        if i%div == 0:
            temp.append(div)
            i = i//div
        else:
            div += 1
    factors.append(temp)

mod = int(1e9+7)
n = int(input())
if n == 1:
    print(1)
else:
    div = []
    for i in range(2,n+1):
        for k in range(len(factors[i])):
            div.append(factors[i][k])
    s = collections.Counter(div)
    ans = 1
    for i in s:
        ans = ans*(s[i]+1)%mod
    print(ans)

Submission status: Accepted

Solution code:
import math
def isPrime(num):
    if num < 2: return False
    elif num == 2: return True
    for i in range(2,math.floor(math.sqrt(num))+1):
        if num % i == 0:
            return False
    return True

n=int(input())
if n==1:print(1);exit()
l=[i for i in range(1,n+1) if isPrime(i)==True]
ans=1
INF=10**9+7
for i in l:
    tmp=0
    tmpi=i
    while n//i>0:
        tmp+=n//i
        i*=tmpi
    ans=(ans*(tmp+1))%INF
print(ans)