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 Go (1.6) (judge verdict: Accepted)

package main

import (
	"fmt"
)

const DEVIDE int64 = 1000000007
var primeSieve []bool
var primes []int

func main() {
	var n int
	fmt.Scan(&n)
	initPrime(n + 1)
	counter := make(map[int]int)
	for _, prime := range primes {
		counter[prime] = 1
	}
	for i := 2; i <= n; i++ {
		factors := primeFactors(i)
		for _, prime := range factors {
			counter[prime]++
		}
	}
	var answer int64 = 1
	for _, count := range counter {
		answer = answer * int64(count) % DEVIDE
	}
	fmt.Println(answer)
}

func isPrime(number int) bool {
	return primeSieve[number]
}

// 自然数 max 未満の素数の配列をエラトステネスのふるいで求める
func initPrime(max int) {
	primeSieve = make([]bool, max+1)
	primes = make([]int, 1, max)
	primes[0] = 2
	for n := 2; n < max; n++ {
		primeSieve[n] = true
	}
	for n := 2; n < max; n++ {
		if !primeSieve[n] {
			continue
		}
		primes = append(primes, n)
		for m := n * 2; m < max; m += n {
			primeSieve[m] = false
		}
	}
}

func primeFactors(number int) []int {
	if (isPrime(number)) {
		return []int{number}
	}
	factors := make([]int, 0, 10)
	for i := 0; primes[i] <= number; i++ {
		prime := primes[i]
		for number % prime == 0 {
			factors = append(factors, prime)
			number /= prime
		}
	}
	return factors
}