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.42.0) (judge verdict: Accepted)

use proconio::input;
use std::collections::HashMap;

const MOD: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
    }

    let mut map = HashMap::new();

    for i in 2..=n {
        for (key, val) in factors(i) {
            *map.entry(key).or_insert(0) += val;
        }
    }

    let mut ans = 1;

    for (_, val) in map.into_iter() {
        ans *= val+1;
        ans %= MOD;
    }

    println!("{}", ans);
}

fn factors(n: usize) -> HashMap<usize, usize> {
    let mut x = n;
    let mut ret = HashMap::new();
    for i in 2..n {
        if i * i > n {
            break;
        }
        if x % i != 0 {
            continue;
        }
        while x > 0 && x % i == 0 {
            x /= i;
            *ret.entry(i).or_insert(0) += 1;
        }
    }
    if x > 1 {
        *ret.entry(x).or_insert(0) += 1;
    }
    ret
}