OFFSET
1,4
COMMENTS
A139391(n) = (3*n+1)/2^e is the "reduced" Collatz step and a(n) is the change in region number m on going n -> A139391(n), where region m is range (2^m, 2^(m+1)-1).
a(n) is at most 1 since the step always has e >= 1.
a(n) = 0 iff n is in A390595, since region number here and binary length there are equivalent for any n with e=1.
The a(n) with even n are the negated terms of the ruler function A001511.
----------------------------------------------------------------------------------------------
m | Terms | Sums per region
| (negative terms to left regions, positive to right regions) | Cf. A392003 (negated)
----------------------------------------------------------------------------------------------
0 | 0 | 0
1 | -1, 1 | 0
2 | -2, -2, -1, 1 | -4
3 | -3, -1, -1, 1, -2, -1, -1, 1 | -7
4 | -4, -1, -1, 0, -2, -4, -1, 1, -3, 0, -1, 1, -2, -1, -1, 1 | -18
5 | -5, -1, -1, 0, -2, ..................... , 1, -2, -1, -1, 1 | -35
6 | -6, -1, -1, 0, -2, ..................... , 1, -2, -1, -1, 1 | -74
7 | -7, -1, -1, 0, -2, ..................... , 1, -2, -1, -1, 1 | -147
8 | -8, -1, -1, 0, -2, ..................... , 1, -2, -1, -1, 1 | -298
: | : | :
----------------------------------------------------------------------------------------------
The ratio: -Sum of terms in region m / 2^m tends to be 7/6 (= A177057) for m -> oo.
LINKS
Karl-Heinz Hofmann, Table of n, a(n) for n = 1..16384
FORMULA
a(2*n) = -1 * A001511(n).
MATHEMATICA
a[n_] := Subtract @@ BitLength[{(# / 2^IntegerExponent[#, 2])& @ If[OddQ[n], 3*n + 1, n], n}]; Array[a, 100] (* Amiram Eldar, Dec 27 2025 *)
PROG
(PARI) a390768(n) = if(n%2, my(m=3*n+1); #binary(m/2^valuation(m, 2)) - #binary(n), -valuation(n, 2)) \\ Hugo Pfoertner, Dec 27 2025
(Python)
def A390768(n):
bitlen = n.bit_length()
if n % 2: n = 3 * n + 1
while n % 2 == 0: n //= 2
return n.bit_length() - bitlen
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Karl-Heinz Hofmann, Nov 18 2025
STATUS
approved
