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.

A387078 Run lengths of A386482(n) mod 2 == n mod 2.

Original entry on oeis.org

1, 3, 2, 4, 2, 3, 3, 5, 3, 4, 2, 8, 5, 3, 4, 4, 2, 11, 4, 2, 2, 22, 16, 5, 3, 1, 2, 12, 6, 31, 14, 4, 3, 8, 3, 28, 2, 37, 14, 10, 12, 9, 2, 41, 7, 61, 24, 24, 2, 134, 71, 51, 97, 3, 2, 127, 69, 39, 15, 64, 55, 56, 26, 100, 37, 32, 40, 33, 2, 440, 107, 196, 391
Offset: 1

Views

Author

Michael De Vlieger, Aug 15 2025

Keywords

Comments

Let S = A386482.
Beginning with S(481) = 948, there are 100 consecutive even terms in S. Starting with S(730076) = 1026330, there are 100869 consecutive even terms in S.

Examples

			S begins as follows, grouping odd terms in brackets [], and even in parentheses ():
   [1], (2, 4, 6), [3, 9], (12, 10, 8, 14), [7, 21], (18, 16, 20), [15, 5, 25], ...
This sequence takes run lengths in the order they appear, therefore a(1) = 1, a(2) = 3, a(3) = 2, a(4) = 4, a(5) = 2, etc. Hence a(n) for odd n pertains to run lengths of odd terms in S, while a(n) for even n pertains to run lengths of even terms in same.
		

Crossrefs

Cf. A386482.

Programs

  • Mathematica
    Block[{c, j, k, m, p, r, nn},
      nn = 2^12; c[] := False; m[] := 1; j = 2; c[1] = c[2] = True; r = 1;
      {1}~Join~Monitor[Most@ Reap[Do[
        If[PrimePowerQ[j],
          Set[{p, k, m}, {#1, #1^(#2 - 1), #1^(#2 - 1)}] & @@
            FactorInteger[j][[1]]; While[And[c[k*p], k != 0], k--];
            If[k == 0, k = m; While[c[k*p], k++]]; k *= p,
          k = j - 1; While[And[Or[c[k], CoprimeQ[j, k]], k != 1], k--];
            If[k == 1, k += j; While[Or[c[k], CoprimeQ[j, k] ], k++] ] ];
        If[Mod[j, 2] == Mod[k, 2], r++, Sow[r]; r = 1];
        Set[{c[k], j}, {True, k}], {n, 3, nn}] ][[-1, 1]], n] ]