Quido is currently preparing examples for his new book on cybersecurity. He is focusing on linear congruential
generators of pseudorandom numbers in which moduli are primes. These generators have various interesting properties and Quido decided to study
some particular classes of these generators. One such class is specified below.
We say that a positive integer is an odd-squarefree number if it is not divisible by square of any odd prime.
Let the abbreviation LCG stand for linear congruential generator.
Let the abbreviation LCM stand for least common multiple.
Let Mmin, Mmax, R be three integers, such that 2 ≤ Mmin ≤ Mmax, 2 ≤ R.
We say that a combined linear congruential generator L is an acceptable combined linear congruential generator
(abbreviated as ACLCG)
if and only if it satisfies all following conditions.
You are given the values of Mmin, Mmax and R. Find the number of categorically different ACLCGs.
The input contains one text line with three positive integers Mmin, Mmax, R.
The values of Mmin and Mmax represent the minimum and the maximum possible value of the moduli of
all LCGs of which one ACLCG consists. The value R specifies the number of LCGs in the ACLCG.
It holds, 2 ≤ Mmin ≤ Mmax ≤ 2×106, 2 ≤ R ≤ 8, (Mmax − Mmin) × R ≤ 180000.
The output contains one text line with one integer, the number of categorically different ACLCGs. It does not exceed 11×106.
150 260 3Output
2Comment
{163, 197, 251} {197, 199, 251}
100 200 2Output
6Comment
{101, 127} {101, 163} {101, 199} {151, 197} {163, 197} {197, 199}
2000 3000 4Output
16Comment
{2029, 2351, 2663, 2843} {2053, 2351, 2663, 2843} {2287, 2351, 2549, 2663} {2287, 2351, 2663, 2843} {2351, 2467, 2549, 2663} {2351, 2467, 2663, 2843} {2351, 2503, 2549, 2663} {2351, 2503, 2663, 2843} {2351, 2549, 2663, 2683} {2351, 2549, 2663, 2719} {2351, 2557, 2663, 2843} {2351, 2593, 2663, 2843} {2351, 2663, 2683, 2843} {2351, 2663, 2719, 2843} {2351, 2663, 2843, 2917} {2351, 2663, 2843, 2953} 2028 = 2^2 . 3 . 13^2, 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2052 = 2^2 . 3^3 . 19, 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2286 = 2 . 3^2 . 127, 2350 = 2 . 5^2 . 47, 2548 = 2^2 . 7^2 . 13, 2662 = 2 . 11^3 2286 = 2 . 3^2 . 127, 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2466 = 2 . 3^2 . 137, 2548 = 2^2 . 7^2 . 13, 2662 = 2 . 11^3 2350 = 2 . 5^2 . 47, 2466 = 2 . 3^2 . 137, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2502 = 2 . 3^2 . 139, 2548 = 2^2 . 7^2 . 13, 2662 = 2 . 11^3 2350 = 2 . 5^2 . 47, 2502 = 2 . 3^2 . 139, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2548 = 2^2 . 7^2 . 13, 2662 = 2 . 11^3, 2682 = 2 . 3^2 . 149 2350 = 2 . 5^2 . 47, 2548 = 2^2 . 7^2 . 13, 2662 = 2 . 11^3, 2718 = 2 . 3^2 . 151 2350 = 2 . 5^2 . 47, 2556 = 2^2 . 3^2 . 71, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2592 = 2^5 . 3^4, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2682 = 2 . 3^2 . 149, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2718 = 2 . 3^2 . 151, 2842 = 2 . 7^2 . 29 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29, 2916 = 2^2 . 3^6 2350 = 2 . 5^2 . 47, 2662 = 2 . 11^3, 2842 = 2 . 7^2 . 29, 2952 = 2^3 . 3^2 . 41
The public data set is intended for easier debugging and approximate program correctness checking. The public data set is stored also in the upload system and each time a student submits a solution it is run on the public dataset and the program output to stdout and stderr is available to him/her.
Link to public data set