#000096

z-ssp

For given A and B, you have to count how many numbers in the interval [ A, B ] can be represented as a sum of at least 2 squares and at most K squares of prime numbers.


InputStandard input will contain three integers A (1 <= A <= B), B (1 <= B <= 20 000) and K (2 <= K <= 20).

OutputOn the standard ouput you should print how many numbers in the interval [ A, B ] can be represented in the decsribed way.

Input:
1 20 4
Output:
6
The following numbers can be represented as a sum of at least 2 and at most 4 squares of prime numbers:
8 = 2<sup>2</sup> + 2<sup>2</sup>; 12 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 13 = 2<sup>2</sup> + 3<sup>2</sup>;
16 = 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup> + 2<sup>2</sup>; 17 = 2<sup>2</sup> + 2<sup>2</sup> + 3<sup>2</sup>; 18 = 3<sup>2</sup> + 3<sup>2</sup>.

Input:
37 57 3
Output:
6

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.