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.

A333861 The sum of the Hamming weights of the elements of the Collatz orbit of n.

Original entry on oeis.org

1, 2, 11, 3, 7, 13, 35, 4, 43, 9, 29, 15, 16, 38, 43, 5, 24, 45, 49, 11, 10, 32, 35, 17, 58, 19, 527, 41, 42, 47, 507, 6, 66, 26, 28, 47, 50, 52, 100, 13, 520, 13, 73, 35, 34, 39, 497, 19, 59, 61, 66, 22, 21, 531, 537, 44, 85, 46, 91, 51, 52, 512, 523, 7, 67
Offset: 1

Views

Author

Markus Sigg, Apr 08 2020

Keywords

Examples

			The Collatz orbit of 3 is 3,10,5,16,8,4,2,1. The Hamming weights are 2,2,2,1,1,1,1,1. The sum is a(3) = 11.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Total[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 65] (* Amiram Eldar, Jul 29 2023 *)
  • PARI
    a(n) = my(c = hammingweight(n)); while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c += hammingweight(n)); c;

Formula

a(n) = Sum_{k=1..A008908(n)} A000120(A070165(n,k)). - Alois P. Heinz, Apr 10 2020
a(n) = a(A006370(n)) + A000120(n), with a(1) = 1. - Alan Michael Gómez Calderón, Jul 15 2025