#P9865. Coprime Sequence Extraction
Coprime Sequence Extraction
Coprime Sequence Extraction
Given a positive integer n, a number b is called a "non-friendly number" of n if \(\gcd(n, b) = 1\). In other words, b is coprime with n.
Your task is: given three positive integers n, k, and c, find the ascending sorted sequence of all numbers that are coprime with n (i.e. its non-friendly numbers), and output c consecutive numbers starting from the k-th number in that sequence. The indexing is 1-based.
The sequence is infinite and exhibits a periodic pattern with period n since for any number x coprime with n, x+n is also coprime with n.
Note on Mathematical Notation: All formulas are formatted in LaTeX. For example, the coprimality condition is given as \(\gcd(n,b)=1\).
inputFormat
The input consists of a single line with three space-separated integers: n, k, and c.
Constraints: You can assume that n, k, and c are positive integers, and that the output numbers fit within the standard integer range.
outputFormat
Output a single line containing c integers separated by a space, which are the consecutive numbers in the ordered sequence of numbers coprime to n, starting from the k-th such number.
sample
10 1 5
1 3 7 9 11