|
|
A333861
|
|
The sum of the Hamming weights of the elements of the Collatz orbit of n.
|
|
2
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
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.
|
|
MATHEMATICA
|
a[n_] := Total[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 65] (* Amiram Eldar, Jul 29 2023 *)
|
|
PROG
|
(PARI) a(n) = {
my(c = hammingweight(n));
while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c += hammingweight(n));
c;
}
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|