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 Scala (2.11.7) (judge verdict: Wrong Answer)

import scala.io.StdIn._

/**
 * Created by sonetsuyoshi on 2015/12/16.
 */

object Main extends App {
  val MOD = 1000000007

  val N = readInt

  def primesUnder(n: Int): List[Int] = {
    require(n >= 2)

    def rec(i: Int, primes: List[Int]): List[Int] = {
      if (i > n) primes
      else if (prime(i, primes)) rec(i + 1, i :: primes)
      else rec(i + 1, primes)
    }

    rec(2, List()).reverse
  }

  def prime(num: Int, factors: List[Int]): Boolean = factors.forall(num % _ != 0)

  val primes = primesUnder(N)

  val expos = primes.map(x => {
    1.to(N).foldLeft(0)((s, n) => {
      var m = n
      var count = 0
      while(m % x == 0) {
        m /= x
        count += 1
      }
      s + count
    })
  })
  println(expos.foldLeft(1)((s, n) => s * (n + 1) % MOD))
}