OFFSET
1,3
COMMENTS
a(n) is the sum of the nonpowers of 2 in the n-th row of A347270.
a(n) = 0 if and only if n is a power of 2.
LINKS
FORMULA
From Alois P. Heinz, Sep 05 2021: (Start)
EXAMPLE
For n = 6 the 3x+1 sequence starting at 6 is 6, 3, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, ... Only the first four terms are nonpowers of 2. The sum of them is 6 + 3 + 10 + 5 = 24, so a(6) = 24.
MAPLE
a:= proc(n) option remember; `if`(n=2^ilog2(n), 0,
n+a(`if`(n::odd, 3*n+1, n/2)))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Sep 05 2021
MATHEMATICA
a[n_] := Plus @@ Select[NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &], # != 2^IntegerExponent[#, 2] &]; Array[a, 50] (* Amiram Eldar, Sep 06 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Omar E. Pol, Sep 05 2021
STATUS
approved