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 C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Factors of Factorial
            int n = int.Parse(Console.ReadLine());

            var factors = new List<int>();
            var lib = new Library.Factorization();

            for(int i = 2; i <= n; i++)
            {
                var f = lib.GetFactors(i);
                factors.AddRange(f.ConvertAll(x => (int)x));
            }

            long count = CountDivisors(factors);

            Console.WriteLine(count);
        }
              
        static long CountDivisors(List<int> factors)
        {
            //[summary]ある数の約数の個数を取得

            //素因数分解した結果を受け取る
            var dic = SummarizeFactors(factors);

            long count = 1;

            foreach (var value in dic.Values)
            {
                count *= (value + 1);
            }

            return count;
        }

        static Dictionary<int, int> SummarizeFactors(List<int> factors)
        {
            //[summary]素因数分解した結果を、素数,指数...にまとめる
            
            var dic = new Dictionary<int, int>();

            foreach (var factor in factors)
            {
                if (dic.ContainsKey(factor))
                {
                    dic[factor]++;
                }
                else
                {
                    dic.Add(factor, 1);
                }
            }

            return dic;
        }
    }
}

namespace Library
{
    class Factorization
    {
        private List<long> factors;

        public List<long> GetFactors(long n)
        {
            //[summary]ある数を素因数分解する

            //別の数を素因数分解することもあるので、最初にかならず初期化
            factors = new List<long>();

            if (n < 2)
            {
                //2より小さい数を受け取った場合
                factors.Add(n);
            }
            else
            {
                Factoring(n);
            }

            return factors;
        }

        private void Factoring(long n)
        {
            //[summary]平方根以下の素数で総当りで割って行く
            //以下リンクを参考に実装
            //https://qiita.com/gushwell/items/561afde2e00bf3380c98

            //平方根を求める
            long sqrt = (long)Math.Sqrt(n);

            //2,3,5で割る(割れなくなるまで割り続ける)
            n = DevideWith(n, 2);
            n = DevideWith(n, 3);
            n = DevideWith(n, 5);

            var primes = new List<int> { 7, 11, 13, 17, 19, 23, 29, 31 };
            long i = 0;

            //平方根以下の素数(候補)で総当りで割る
            while (n > 1)
            {
                foreach (var p in primes)
                {
                    if (p + i > sqrt)
                    {
                        factors.Add(n);
                        return;
                    }
                    else
                    {
                        n = DevideWith(n, p + i);
                    }
                }

                i += 30;
            }
        }

        private long DevideWith(long n, long d)
        {
            while (n % d == 0)
            {
                factors.Add(d);
                n /= d;
            }

            return n;
        }
    }
}