infO(1)Cup 2025 Day 2 - Mirror | Divisors

This was the problem page during the contest. Access the current page here.
Time limit: 0.4s Memory limit: 64MB Input: Output:

Task

You are given a number NN. You are asked to find the number of sequences a1,,aka_1, \dots, a_k such that a1a2aka_1 | a_2 | \dots | a_k (that is, a1a_1 divides a2a_2, which divides a3a_3, and so on), and N=a1++akN = a_1 + \dots + a_k.

For example, if N=6N = 6, then we have the following values for a1,,aka_1, \dots, a_k:

  1. 66;
  2. 1,51, 5;
  3. 1,1,41, 1, 4;
  4. 1,1,1,31, 1, 1, 3;
  5. 1,1,1,1,21, 1, 1, 1, 2;
  6. 1,1,1,1,1,11, 1, 1, 1, 1, 1;
  7. 1,1,2,21, 1, 2, 2;
  8. 2,42, 4;
  9. 2,2,22, 2, 2;
  10. 3,33, 3.

Hence the answer would be: 1010.

Input data

The first line in the input data contains the number of test cases TT. The TT lines that follow contain the values of NN for which you must compute the answer.

Output data

Output TT lines, the answers for the TT values of NN you are given. Since these answers are quite large, output their remainder modulo 109+710^9+7.

Constraints and clarifications

  • 1T100 0001 \leq T \leq 100 \ 000;
  • 1N500 0001 \leq N \leq 500 \ 000.
# Points Restrictions
1 12 N20N \leq 20
2 21 N100N \leq 100
3 33 N1 000N \leq 1 \ 000
4 34 No further restrictions.

Example

stdin

3
6
10
500000

stdout

10
26
475702494

Explanation

The first test case is explained in the problem description. For N=10N = 10 the answers are:

  1. 1010;
  2. 1,91, 9;
  3. 1,1,81, 1, 8;
  4. 1,1,1,71, 1, 1, 7;
  5. 1,1,1,1,61, 1, 1, 1, 6;
  6. 1,1,1,1,1,51, 1, 1, 1, 1, 5;
  7. 1,1,1,1,1,1,41, 1, 1, 1, 1, 1, 4;
  8. 1,1,1,1,1,1,1,31, 1, 1, 1, 1, 1, 1, 3;
  9. 1,1,1,1,1,1,1,1,21, 1, 1, 1, 1, 1, 1, 1, 2;
  10. 1,1,1,1,1,1,1,1,1,11, 1, 1, 1, 1, 1, 1, 1, 1, 1;
  11. 1,1,1,1,1,1,2,21, 1, 1, 1, 1, 1, 2, 2;
  12. 1,1,1,1,2,41, 1, 1, 1, 2, 4;
  13. 1,1,1,1,2,2,21, 1, 1, 1, 2, 2, 2;
  14. 1,1,1,1,3,31, 1, 1, 1, 3, 3;
  15. 1,1,2,61, 1, 2, 6;
  16. 1,1,2,2,41, 1, 2, 2, 4;
  17. 1,1,2,2,2,21, 1, 2, 2, 2, 2;
  18. 1,1,4,41, 1, 4, 4;
  19. 1,3,61, 3, 6;
  20. 1,3,3,31, 3, 3, 3;
  21. 2,82, 8;
  22. 2,2,62, 2, 6;
  23. 2,2,2,42, 2, 2, 4;
  24. 2,2,2,2,22, 2, 2, 2, 2;
  25. 2,4,42, 4, 4;
  26. 5,55, 5.

So the answer is 2626.

Log in or sign up to be able to send submissions!