I am interested in a function such that f[m, i] = n
where m, n
are positive integers and n
is the i
-th number relatively prime with m
.
Getting a sample of the possible outputs of f
is straightforward. For example, let m = 30
. Now we can use
list = 2 Range[0,29] + 1;
list = Pick[list, GCD[30, list], 1]
(*{1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59}*)
where I'm picking from odd numbers since m
happens to be even. There should be a pattern in these numbers given by EulerPhi[30]
(this is 8
) and indeed, list[[;;8]] + 30
coincides with list[[9;;16]]
. How to continue from here?