login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A333861 The sum of the Hamming weights of the elements of the Collatz orbit of n. 2

%I #41 Jul 29 2023 03:18:50

%S 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,

%T 19,527,41,42,47,507,6,66,26,28,47,50,52,100,13,520,13,73,35,34,39,

%U 497,19,59,61,66,22,21,531,537,44,85,46,91,51,52,512,523,7,67

%N The sum of the Hamming weights of the elements of the Collatz orbit of n.

%H Markus Sigg, <a href="/A333861/b333861.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = Sum_{k=1..A008908(n)} A000120(A070165(n,k)). - _Alois P. Heinz_, Apr 10 2020

%e 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.

%t a[n_] := Total[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 65] (* _Amiram Eldar_, Jul 29 2023 *)

%o (PARI) a(n) = {

%o my(c = hammingweight(n));

%o while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c += hammingweight(n));

%o c;

%o }

%Y Cf. A000120, A008908, A070165, A333860.

%K nonn,base,easy,look

%O 1,2

%A _Markus Sigg_, Apr 08 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 9 10:46 EDT 2024. Contains 375764 sequences. (Running on oeis4.)