login
Number of occurrences through n^2 of the longest gap between numbers relatively prime to n (A132468).
0

%I #8 Sep 16 2015 13:58:14

%S 0,1,2,7,4,6,6,31,26,10,10,24,12,14,30,127,16,54,18,40,42,22,22,96,

%T 124,26,242,56,28,60,30,511,66,34,70,216,36,38,78,160,40,84,42,88,270,

%U 46,46,384,342,250,102,104,52,486,110,224,114,58,58,240,60,62,378,2047,130

%N Number of occurrences through n^2 of the longest gap between numbers relatively prime to n (A132468).

%e For n=3, the longest gap in 1, 2, 4, 5, 7, 8 is 1, between 2 and 4 and again between 5 and 7, so a(3) = 2.

%e For n=4, the longest gap in 1, 3, 5, 7, 9, 11, 13, 15 is 1, at (1,3), (3,5), (5,7), (7,9), (9,11), (11,13) and (13,15), so a(4) = 7.

%e The numbers coprime to 6 and smaller than 36 are {1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35}, the largest distance between two consecutive terms is 4; 4 appears as a distance in the cases (1,5),(7,11),(13,17),(19,23),(25,29) and (31,35) - it appears 6 times. Therefore a(6)=6.

%t a = {}; For[n = 1, n < 70, n++, b = Select[Range[1, n^2], GCD[ #, n] == 1 &]; m = 0; For[j = 1, j < Length[b], j++, If[b[[j + 1]] - b[[j]] > m, m = b[[j + 1]] - b[[j]]]]; c = 0; For[j = 1, j < Length[b], j++, If[b[[j + 1]] - b[[j]] == m, c++ ]]; AppendTo[a, c]]; a (* _Stefan Steinerberger_, Nov 20 2007 *)

%Y Cf. A132468.

%K easy,nonn

%O 1,3

%A _Jonathan Vos Post_, Nov 16 2007

%E Corrected and extended by _Stefan Steinerberger_, Nov 20 2007