%I #17 Oct 01 2012 16:12:34
%S 1,2,1,4,1,2,2,4,1,4,1,4,3,2,1,4,1,4,3,4,1,4,2,4,2,4,1,6,1,2,3,4,3,4,
%T 1,4,3,4,1,6,1,4,3,4,1,4,2,4,3,4,1,4,3,4,3,4,1,6,1,4,3,2,3,6,1,4,3,6,
%U 1,4,1,4,3,4,3,6,1,4,2,4,1,6,3,4,3,4,1,6,3,4,3,4,3,4,1,4,3,4,1,6,1,4,5,4,1
%N List the phi(n) numbers from 1 to n-1 which are relatively prime to n; sequence gives size of maximal gap.
%C Maximal gap in reduced residue system mod n.
%C It is an unsolved problem to determine the rate of growth of this sequence.
%D H. L. Montgomery, Ten Lectures on the Interface Between Analytic Number Theory and Harmonic Analysis, Amer. Math. Soc., 1996, p. 200.
%H T. D. Noe, <a href="/A070194/b070194.txt">Table of n, a(n) for n=3..10000</a>
%F a(n) = max(A048669(n),2) for all n>2. Indeed A048669 is obtained when going up to n+1 instead of only n-1 (because after n+1, the gaps among numbers coprime to n repeat). Since n-1 and n+1 are both coprime to n, this means that A048669(n)=2 whenever a(n)=1, but in all other cases, there is equality. - _M. F. Hasler_, Sep 08 2012
%e For n = 10 the reduced residues are 1, 3, 7, 9; the maximal gap is a(10) = 7-3 = 4.
%t f[n_] := Block[{a = Select[ Table[i, {i, n - 1}], GCD[ #, n] == 1 & ], b = {}, k = 1, l = EulerPhi[n]}, While[k < l, b = Append[b, Abs[a[[k]] - a[[k + 1]]]]; k++ ]; Max[b]]; Table[ f[n], {n, 3, 100}]
%o (PARI) A070194(n)={my(L=1,m=1);for(k=2,n-1,gcd(k,n)>1&next;L+m<k&m=k-L;L=k);m} \\ - _M. F. Hasler_, Sep 08 2012
%o (Haskell)
%o a070194 n = maximum $ zipWith (-) (tail ts) ts where ts = a038566_row n
%o -- _Reinhard Zumkeller_, Oct 01 2012
%Y Cf. A000010.
%Y Cf. A038566.
%K nonn,nice,easy
%O 3,2
%A _N. J. A. Sloane_, May 13 2002
%E More terms from _Robert G. Wilson v_ and _John W. Layman_, May 13 2002