2

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.

Colin Defant
  • 1,327
  • 6
  • 17

1 Answers1

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