Consider a set $S$ of remainders modulo $n$ relatively prime to $n$ and less than $n$, i. e. reduced residue system modulo $n$:
- If $n > 2$ (then $\varphi{(n)}$ is even*): $S = \{1, r_2, ..., r_\frac{{\varphi{(n)}}}{2}, n - r_\frac{{\varphi{(n)}}}{2}, ..., n - r_2, n - 1\}.$ (*We know that if $(x, n) = 1$, then also $(n - x, n) = 1).$)
Let's say I randomly choose $k_1, k_2, ..., k_m$. Now, I want to construct set just as above, will this be possible for any $k_1, k_2, ..., k_m$ I choose? In other words, does such $n$ exists?
For example, I choose numbers $k_1 = 1, k_2 = 2, k_3 = 3, k_4 = 4.$ Now I want to find $n$ such that $S = \{1, 2, 3, 4, n - 4, n - 3, n - 2, n - 1\}$ is reduced residue system. Does this $n$ exist? Is this true for any $k_1, k_2, ..., k_m?$
Thanks.
EDIT. Of course, if I have $k_1, k_2, ..., k_m$ and $k_1 < k_2 < ... < k_m$ and $k_{10} = 25 = 5^2$ for example, I must have some of $k_i, 1 < i < 9$ to equal $5$.
Given $m$ positive integers $k_1,...,k_m$ with $k_1 < \cdots < k_m$, the goal is to find a positive integer $n > k_m$, if any, such that the first $m$ reduced residues modulo $n$ are $k_1,...,k_m$.
Let $K=\{k_1,...,k_m\}$, and let $P$ be the set of primes $p$ such that $p{\,\mid\,}k_i$ for some $i$.
Claim:$\;$A qualifying positive integer $n$ exists if and only if $K$ is the set all positive integers $x\le k_m$ such that all prime divisors of $x$ are in $P$.
Proof of$\;(\!\implies\!)\;$:
Suppose $n > k_m$ is a positive integer such that the first $m$ reduced residues modulo $n$ are $k_1,...,k_m$.
Let $x\in K$.
Then if $p$ is a prime divisor of $x$, we get \begin{align*} & x\in K \\[4pt] \implies\;& x=k_i\;\text{for some}\;i \\[4pt] \implies\;& p{\,\mid\,}k_i \\[4pt] \implies\;& p\in P \\[4pt] \end{align*} hence all prime divisors of $x$ are in $P$.
Conversely, suppose $x\le k_m$ is a positive integer such that all prime divisors of $x$ are in $P$.
Then each prime divisor of $x$ is a divisor of some $k_i$, hence is relatively prime to $n$.
It follows that $\gcd(x,n)=1$, hence from $x\le k_m$, we get $x\in K$.
This completes the proof of$\;(\!\implies\!)$.
Proof of $\;(\!\impliedby\!)\;$:
Suppose $K$ is the set all positive integers $x\le k_m$ such that all prime divisors of $x$ are in $P$.
Let $Q$ be the set of primes $q\le k_m$ such that $q\not\in P$.
Let $n=b(a+1)$ where
Clearly $n > a$, hence $n > k_m$,
Fix $k_i\in K$,
Since all prime divisors of $k_i$ are in $P$, it follows that $\gcd(k_i,b)=1$, and since $k_i{\,\mid\,}a$, it follows that $\gcd(k_i,a+1)=1$.
Hence $\gcd(k_i,n)=1$.
Thus $k_1,...,k_m$ are reduced residues modulo $n$.
Now suppose $x\le k_m$ is a positive integer such that $\gcd(x,n)=1$.
Then if $p$ is a prime divisor of $x$, we get \begin{align*} & \gcd(x,n)=1 \\[4pt] \implies\;& \gcd(x,b)=1 \\[4pt] \implies\;& \gcd(p,b)=1 \\[4pt] \implies\;& p\not\in Q \\[4pt] \implies\;& p\in P \\[4pt] \end{align*} hence all prime divisors of $x$ are in $P$, so $x\in K$.
It follows that the first $m$ reduced residues modulo $n$ are $k_1,...,k_m$.
This completes the proof of $\;(\!\impliedby\!)$.
For an example with $m=10$ and $k_{10}=25$, if $$ K=\{1,2,4,5,8,10,13,16,20,25\} \qquad\qquad\qquad\;\;\;\;\; $$ we get $$ \left\lbrace \begin{align*} P&=\{2,5,13\}\\[4pt] Q&=\{3,7,11,17,19,23\}\\[4pt] a&=(1)(2)(4)(5)(8)(10)(13)(16)(20)(25)=332800000\\[4pt] b&=(3)(7)(11)(17)(19)(23)=1716099\\[4pt] n&=b(a+1)=571117748916099\\[4pt] \end{align*} \right. $$ and then, as can be easily verified, the first $10$ reduced residues modulo $n$ are just the elements of $K$.