cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A347532 a(n) is the sum of the nonpowers of 2 in the 3x+1 sequence that starts at n.

Original entry on oeis.org

0, 0, 18, 0, 5, 24, 257, 0, 308, 15, 228, 36, 88, 271, 663, 0, 183, 326, 488, 35, 21, 250, 602, 60, 627, 114, 101409, 299, 411, 693, 101073, 0, 810, 217, 509, 362, 504, 526, 2313, 75, 101300, 63, 1307, 294, 466, 648, 100948, 108, 775, 677, 1099, 166, 368, 101463, 102285, 355
Offset: 1

Views

Author

Omar E. Pol, Sep 05 2021

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A208981 (number of nonpowers of 2).

Programs

  • 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 *)

Formula

From Alois P. Heinz, Sep 05 2021: (Start)
a(n) = A033493(n) - 2 * A232503(n) + 1.
a(n) = A033493(n) - 2^(A135282(n)+1) + 1. (End)