%I #46 Dec 21 2022 04:49:36
%S 1,4,1,10,3,16,1,22,7,28,5,34,3,40,1,46,15,52,13,58,11,64,9,70,7,76,5,
%T 82,3,88,1,94,31,100,29,106,27,112,25,118,23,124,21,130,19,136,17,142,
%U 15,148,13,154,11,160,9,166,7,172,5,178,3,184,1,190,63
%N a(n) = A035327(n) if n is even, 3n + 1 if n is odd.
%e n parity function a(n)
%e = ===== ========= ======
%e 0 even A035327(0) 1
%e 1 odd 3*1 + 1 4
%e 2 even A035327(2) 1
%e 3 odd 3*3 + 1 10
%e 4 even A035327(4) 3
%e 5 odd 3*5 + 1 16
%o (Python)
%o def A348074(n):
%o if n%2==0:
%o if n==0: return 1
%o else: return (1<<int.bit_length(n)) - n - 1 #A035327(n)
%o else: return 3*n+1
%o (Python)
%o def A348074(n): return 3*n+1 if n&1 or n==0 else (~n)^(-1<<n.bit_length()) # _Chai Wah Wu_, Dec 20 2022
%Y Cf. A006370, A035327.
%K nonn
%O 0,2
%A _Alexander Van Plantinga_, Sep 27 2021