cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

0, 1, 2, 7, 4, 6, 6, 31, 26, 10, 10, 24, 12, 14, 30, 127, 16, 54, 18, 40, 42, 22, 22, 96, 124, 26, 242, 56, 28, 60, 30, 511, 66, 34, 70, 216, 36, 38, 78, 160, 40, 84, 42, 88, 270, 46, 46, 384, 342, 250, 102, 104, 52, 486, 110, 224, 114, 58, 58, 240, 60, 62, 378, 2047, 130
Offset: 1

Views

Author

Jonathan Vos Post, Nov 16 2007

Keywords

Examples

			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.
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.
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.
		

Crossrefs

Cf. A132468.

Programs

  • Mathematica
    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 *)

Extensions

Corrected and extended by Stefan Steinerberger, Nov 20 2007