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 in Rust (1.15.1) (judge verdict: Accepted)

#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    const MOD: usize = 1_000_000_000 + 7;
    let N: usize = read();
    let mut primes = vec![];
    use std::collections::HashMap;
    let mut factors = HashMap::new();
    for i in 2..N + 1 {
        let mut is_composite = false;
        for p in &primes {
            if i % p == 0 {
                is_composite = true;
                let mut i = i;
                let mut add = 0;
                while i % p == 0 {
                    add += 1;
                    i /= *p;
                }
                let entry = factors.entry(p.clone()).or_insert(0);
                *entry += add;
            }
        }
        if is_composite {
            continue;
        }
        factors.entry(i).or_insert(1);
        primes.push(i);
    }

    let ans = factors
        .iter()
        .fold(1, |acc, (&_key, &value)| acc * (value + 1) % MOD);
    println!("{}", ans);
}