%I #40 Dec 31 2022 15:15:22
%S 0,1,2,5,10,21,39,40,42,71,72,78,85,142,150,157,163,167,168,170,285,
%T 291,300,303,311,313,315,316,317,319,320,321,322,327,328,329,331,333,
%U 334,335,336,338,339,340,341,569,571,572,573,575,576,577,578,579
%N Numbers that under iteration of the map x->A359194(x) (binary complement of 3n) until 0 is reached never exceed the initial term.
%C If it can be shown that all iterations of A359194 eventually reach one of the terms of this sequence, it would prove that all such trajectories are finite.
%C From _M. F. Hasler_, Dec 26 2022: (Start)
%C (1) If A359194(x) = a(k) for some a(k) < x, then x is also in the sequence.
%C (2) The orbit of any x under iterations of A359194 is finite if and only if it reaches a term of this sequence.
%C (3) No term has binary digits starting with '11...', i.e., all terms > 1 have binary digits starting '10...'.
%C (4) If the 3rd binary digit of a(n) is a '1', it cannot be followed by another bit 1, so all terms > 5 have a binary representation of the form '100...' or '1010...'
%C (5) A substring of '11', i.e., two consecutive bits 1, in a term of this sequence, is necessarily preceded by an earlier substring '00', i.e., two consecutive bits 0 to the left of the '11'. [This implies (3) and (4).] (End)
%e 40 is a term since its trajectory is 40 -> 7 -> 10 -> 1 -> 0, which never exceeds 40.
%p bc:= n -> 2^(1+ilog2(n))-1-n: bc(0):= 1:
%p filter:= proc(n) local x;
%p x:= n;
%p while x <> 0 do
%p x:= bc3(x);
%p if x > n then return false fi;
%p od;
%p true
%p end proc:
%p select(filter, [$0..1000]); # _Robert Israel_, Dec 22 2022
%t f[n_] := BitXor[3 n, 2^IntegerPart[Log2[3 n] + 1] - 1]; Select[Range[200], Function[n, AllTrue[NestWhileList[f, n, # != 0 &], # <= n &]] (* _Michael De Vlieger_, Dec 21 2022 *)
%o (Python)
%o def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
%o def ok(n):
%o i, fi, m = 0, n, n
%o while fi != 0 and m <= n: i, fi, m = i+1, f(fi), max(m, fi)
%o return m <= n
%o print([k for k in range(580) if ok(k)]) # _Michael S. Branicky_, Dec 20 2022
%o (PARI) f(n) = if(n, bitneg(n, exponent(n)+1), 1); \\ A035327
%o isok(m) = my(km=m); while (m, m=f(3*m); if (m>km, return(0))); return(1); \\ _Michel Marcus_, Dec 21 2022
%Y Cf. A035327, A359194, A359207, A359208, A359255.
%K nonn,base
%O 1,3
%A _Joshua Searle_, Dec 20 2022