login
The cardinalities of 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).
1

%I #42 Aug 10 2020 13:18:46

%S 0,1,4,9,10,20,23,24,33,34,39,42,43,46,141,142,145,146,149,161,162,

%T 170,173,174,179,180,187,190,191,204,205,208,209,212,220,221,230,231,

%U 232,239,240,243,244,247,252,253,256,257,260,261,262,267,270,271,284,285

%N The cardinalities of 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).

%o (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))); };

%o 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; };

%o makeVec(m) = { my(v = [], A = Set([]), i); for(i = 1, m, v = concat(v, #A); if (i < m, A = iter(A))); v; };

%o makeVec(56)

%Y Cf. A061641, A336938.

%K nonn

%O 0,3

%A _Markus Sigg_, Aug 08 2020