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)

use std::io;
use std::str::FromStr;
use std::collections::HashSet;
use std::collections::HashMap;

static MOD: u64 = 1_000_000_007;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn calc_prime_numbers(n: u64) -> HashSet<u64> {
    let limit: u64 = (n as f64).sqrt() as u64;
    let mut prime_numbers: HashSet<u64> = HashSet::new();
    for i in 2..(limit+1) {
        let mut flag = true;
        for p in &prime_numbers {
            if i % p == 0 {
                flag = false;
            }
        }
        if flag {
            prime_numbers.insert(i);
        }
    }
    prime_numbers
}

fn main() {
    let n: u64 = input();
    let prime_nums = calc_prime_numbers(1000000);
    let mut divisor_count: HashMap<u64, u64> = HashMap::new();
    // println!("{:?}", prime_nums);
    for i in 1..(n+1) {
       for p in &prime_nums {
           let mut num = i;
           while num % *p == 0 {
                num /= *p;
                let n = divisor_count.entry(*p).or_insert(0);
                *n += 1;
           }
           if num == 1 {
               break;
           }
       }
    }

    let mut ans = 1;
    for i in divisor_count.values() {
        ans *= (i+1);
        ans %= MOD;
    }
    // divisor_count.remove(&1);
    // println!("{:?}", divisor_count);
    println!("{}", ans);
}