#FT0000099. Chia hết cho 3 (Divisible by 3)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Chia hết cho 3 (Divisible by 3)
Divisible by 3
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , let denote the sum of all positive divisors of , including and . For example, the positive divisors of are , so .
A positive integer is called good if its positive-divisor sum is divisible by , that is, . Note that the condition applies to the sum of divisors, not necessarily to the integer itself.
You are given two positive integers and . Consider all ordered sequences of exactly positive integers. A sequence is valid if the product
is both at most and a good integer. Two sequences are distinct if they differ in at least one position; therefore, their ordering matters.
Count all valid sequences modulo .
Input
A single line containing two positive integers and , the upper bound on the product and the required sequence length, respectively.
Output
Print a single integer: the number of valid length- sequences, modulo .
Subtasks
- Subtask 1 (20 points): ; ; are integers.
- Subtask 2 (30 points): ; ; are integers.
- Subtask 3 (50 points): ; ; are integers.
Examples
Example 1
Input
10 1
Output
5
Explanation
Since , every sequence contains one integer, which is also its product. We inspect integers through and compute their divisor sums. We obtain , , , , and . All five sums are divisible by .
No other integer in has a divisor sum divisible by . Therefore the valid sequences are precisely , , , , and , and the answer is .
Example 2
Input
4 2
Output
2
Explanation
Every sequence has exactly two positive elements and product at most . The divisor sums of possible products are , , , and . Only the product is good.
There are exactly two ordered pairs of positive integers with product : and . Since their entries occur in different positions, they are distinct sequences, so the answer is .