Statistics

Problem Statement for "TwoClassTrip"

Problem Statement

Time limit: 3 seconds.


Two non-empty classes of kids (class A and class B) went together on a school trip. During the trip they played a game. We know the following about the trip and the game:

  • Class A contained at most N kids.
  • Class B contained at most as many kids as class A.
  • For the game, all kids in class A divided themselves evenly into teams of size a, and all kids in class B divided themselves evenly into teams of size b.
  • The choice of a and b was a part of the game strategy. These two values could have been equal or distinct - each was chosen independently of each other.
  • There is one additional limit on team sizes: each class can only choose a team size that can also be chosen by the other class.

For example, if N=100 one valid possibility is that class A had 100 kids who split into groups of 5, while class B had 70 kids who split into groups of 2.

(In the above scenario note that class B cannot pick team size 7: even though they can split evenly into teams of size 7, their opponents don't have this option and thus the last rule forbids this choice.)


Given N, count all scenarios consistent with the description given above, and return that count modulo 10^9 + 7.

Definition

Class:
TwoClassTrip
Method:
count
Parameters:
int
Returns:
int
Method signature:
int count(int N)
(be sure your method is public)

Notes

  • Formally, scenarios are 4-tuples (size of class A, size of class B, team size a, team size b).

Constraints

  • N will be between 1 and 5,000,000, inclusive.

Examples

  1. 1

    Returns: 1

    Only a trivial solution: one kid in class A and one kid in class B, each forming a single team of size 1.

  2. 2

    Returns: 6

    Now we get five more options: if class A had size 2 and class B size 1 both classes had to form teams of size 1, and if both classes had two kids in them, there are four possible combinations of chosen team sizes.

  3. 3

    Returns: 12

  4. 4

    Returns: 27

  5. 5000000

    Returns: 937336804

  6. 4975645

    Returns: 361874057

  7. 4888980

    Returns: 552044086

  8. 4999047

    Returns: 305129435

  9. 4784789

    Returns: 58570673

  10. 4567890

    Returns: 980756084

  11. 4412234

    Returns: 857766095

  12. 4098765

    Returns: 145596022

  13. 3938327

    Returns: 807200240

  14. 3553456

    Returns: 160799126

  15. 2345678

    Returns: 334705846

  16. 1009876

    Returns: 938570966

  17. 87655

    Returns: 795424060

  18. 5365

    Returns: 59071266

  19. 5

    Returns: 35

  20. 6

    Returns: 65

  21. 7

    Returns: 75

  22. 8

    Returns: 112

  23. 9

    Returns: 135

  24. 10

    Returns: 175


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: