How can I create the standard reduced residue system modulo $m$ in Mathematica for a given positive integer $m$? For example, if I input $10$, I would like it to give me the list $\{1,3,7,9\}$. Thanks.
Asked
Active
Viewed 197 times
1 Answers
2
This would be more appropriate on mathematica.stackexchange.com but, for the time being:
residueSystem[n_Integer?Positive] :=
Select[Range[n], GCD[#, n] == 1 &];
residueSystem[10]
(* Out: {1, 3, 7, 9} *)
Mark McClure
- 31,496