P9865 [POI 2021/2022 R2] lic
Background
Translated from [POI2021~2022R2 Day1T2](https://szkopul.edu.pl/problemset/problem/kQ5ExYNkFhx3K2FvVuXAAbn4/statement/)。
Description
Define the “unfriendly numbers” $b$ of $a$ as the numbers satisfying $\gcd(a,b)=1$。
Now you are given the number $n$。You need to output the $c$ numbers starting from the $k$-th number in the increasing order of its “unfriendly numbers”。
Input Format
One line with three numbers $n,k,c\ (2 \leq n \leq 10^{14}, 1 \leq k \leq 10^{14}, 1 \leq c \leq 10^5)$。
Output Format
Output $c$ numbers, representing the $k \sim k+c-1$-th “unfriendly numbers” of $n$。
Explanation/Hint
Explanation of the sample:
The “unfriendly numbers” of $10$ are $1,3,7,9,11,13,17\ldots$ in order。
The subtasks are as follows:
| Subtask ID | Special Property | Score |
| :----------- | :----------- | :----------- |
| $1$ | $n \leq 10^6$ and $M \leq n$ | $10$ |
| $2$ | $f(n) \leq 10^6$ and $M \leq n$ | $36$ |
| $3$ | $c \leq 100$ | $30$ |
| $4$ | No special limits | $24$ |
Here, $M$ is the maximum value in the output, and $f(n)$ is the count of “unfriendly numbers” $\leq n$。
Translated by ChatGPT 5