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)

#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

// Sieve of Eratosthenes
fn get_primes(input: i64) -> Vec<i64> {
    let N: usize = max(input, 100) as usize;

    let mut Alive = vec![true; N];
    Alive[0] = false;
    Alive[1] = false;

    // i番目の素数が分かる (0-origin)
    let mut Ps: Vec<i64> = Vec::new();

    for smallest in 2..=((N as f64).sqrt()) as usize + 1 {
        if !Alive[smallest] {
            continue;
        }

        for i in (smallest * 2..N).step_by(smallest) {
            Alive[i] = false;
        }
    }

    for i in 2..N {
        if Alive[i] {
            Ps.push(i as i64);
        }
    }

    return Ps;
}

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

    const MOD: usize = 1000_000_000 + 7;

    // 下準備1: 2~1000までの素数を求めておく
    let primes = get_primes(1001);

    // 素数pがキー、肩の指数が値
    let mut cnt_map: HashMap<i64, usize> = HashMap::new();

    for n in 1..=(N as i64) {
        // ループの内側が10^4程度であればOK

        let mut res = n;
        let lim: i64 = (n as f64).sqrt() as i64 + 1;
        for &p in primes.iter() {
            if p > lim {
                break;
            }

            if res % p == 0 {
                let mut cnt: usize = 0;
                while res % p == 0 {
                    res /= p;
                    cnt += 1;
                }
                let orig_cnt: usize = *cnt_map.get(&p).or(Some(&0)).unwrap();
                cnt_map.insert(p, orig_cnt + cnt);
            }
        }

        // 割り切れなかったら、それは素数
        if res > 1 {
            let orig_cnt: usize = *cnt_map.get(&res).or(Some(&0)).unwrap();
            cnt_map.insert(res, orig_cnt + 1);
        }
    }

    let mut ans: usize = 1;
    for (_p, cnt) in cnt_map.iter() {
        ans = (ans * (cnt + 1)) % MOD;
    }

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