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.

A336992 The number of gaps in the sets A(n), where A(0) is the empty set and A(n+1) is the union of A(n) and the Collatz orbit of the smallest natural number missing in A(n).

Original entry on oeis.org

0, 0, 1, 3, 3, 9, 9, 8, 12, 12, 14, 15, 15, 16, 100, 99, 100, 100, 101, 108, 108, 112, 111, 110, 110, 110, 110, 111, 110, 116, 115, 115, 115, 116, 120, 120, 124, 123, 122, 122, 121, 122, 122, 123, 125, 124, 125, 125, 126, 125, 125, 127, 127, 126, 133, 133
Offset: 0

Views

Author

Markus Sigg, Aug 10 2020

Keywords

Comments

The number of gaps would be relevant for sparse representations of the sets A(n), which may be of use for a numerical verification of the Collatz conjecture up to a given number.

Crossrefs

Programs

  • PARI
    firstMiss(A) = { my(i); if(#A == 0 || A[1] > 0, return(0)); for(i = 1, A[#A] + 1, if(!setsearch(A, i), return(i))); };
    iter(A) = { my(a = firstMiss(A)); while(!setsearch(A, a), A = setunion(A, Set([a])); a = if(a % 2, 3*a+1, a/2)); A; };
    nGaps(A) = { my(i,c=0); for (i=2, #A, if (A[i-1] < A[i]-1, c = c+1;)); c; };
    makeVec(m) = { my(v = [], A = Set([]), i); for(i = 1, m, v = concat(v, nGaps(A)); if (i < m, A = iter(A))); v; };
    makeVec(57)