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.

A333860 The maximum Hamming (binary) weight of the elements of the Collatz orbit of n, or -1 if 1 is never reached.

This page as a plain text file.
%I A333860 #37 Jul 29 2023 03:18:28
%S A333860 1,1,2,1,2,2,3,1,3,2,3,2,3,3,4,1,3,3,4,2,3,3,4,2,4,3,8,3,4,4,8,1,4,3,
%T A333860 4,3,3,4,5,2,8,3,4,3,4,4,8,2,3,4,4,3,4,8,8,3,4,4,5,4,5,8,8,1,3,4,4,3,
%U A333860 3,4,8,3,8,3,4,4,4,5,6,2,5,8,8,3,4,4,5
%N A333860 The maximum Hamming (binary) weight of the elements of the Collatz orbit of n, or -1 if 1 is never reached.
%H A333860 Markus Sigg, <a href="/A333860/b333860.txt">Table of n, a(n) for n = 1..10000</a>
%F A333860 a(n) = max(A000120(n), A352895(n)) = max(A000120(n), a(A006370(n))). - _Antti Karttunen_, Apr 10 2022
%e A333860 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 maximum is a(3) = 2.
%t A333860 a[n_] := Max[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 100] (* _Amiram Eldar_, Jul 29 2023 *)
%o A333860 (PARI) a(n) = {
%o A333860 my(c = hammingweight(n));
%o A333860 while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c = max(c, hammingweight(n)));
%o A333860 c;
%o A333860 }
%Y A333860 Cf. A000120, A006370, A008908, A070165, A333861, A352895, A352897.
%K A333860 nonn,easy,base
%O A333860 1,3
%A A333860 _Markus Sigg_, Apr 08 2020
%E A333860 Escape clause added to the definition by _Antti Karttunen_, Apr 10 2022