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.
%I A381962 #11 Mar 14 2025 21:19:40 %S A381962 0,1,2,1,3,2,1,4,1,5,2,1,6,2,1,7,3,2,1,8,1,9,2,1,10,2,1,11,3,2,1,12,2, %T A381962 1,13,3,2,1,14,3,2,1,15,4,1,16,1,17,2,1,18,2,1,19,3,2,1,20,2,1,21,3,2, %U A381962 1,22,3,2,1,23,4,1,24,2,1,25,3,2,1,26,3,2,1 %N A381962 Irregular triangle read by rows, where row n lists the iterates of f(x), starting at x = n until f(x) <= 1, where f(x) is the Hamming weight of x (A000120). %H A381962 Paolo Xausa, <a href="/A381962/b381962.txt">Table of n, a(n) for n = 0..11724</a> (rows 0..3000 of triangle, flattened). %F A381962 T(n,0) = n and, for k = 1..A180094(n), T(n,k) = A000120(T(n,k-1)). %e A381962 Triangle begins: %e A381962 n\k| 0 1 2 3 %e A381962 ---------------- %e A381962 0 | 0; %e A381962 1 | 1; %e A381962 2 | 2, 1; %e A381962 3 | 3, 2, 1; %e A381962 4 | 4, 1; %e A381962 5 | 5, 2, 1; %e A381962 6 | 6, 2, 1; %e A381962 7 | 7, 3, 2, 1; %e A381962 8 | 8, 1; %e A381962 9 | 9, 2, 1; %e A381962 10 | 10, 2, 1; %e A381962 ... %t A381962 A381962row[n_] := NestWhileList[DigitSum[#, 2] &, n, # > 1 &]; %t A381962 Array[A381962row, 30, 0] %o A381962 (Python) %o A381962 def row(n): %o A381962 out = [n] if n > 1 else [] %o A381962 while (n:=n.bit_count()) > 1: %o A381962 out += [n] %o A381962 return out + [n] %o A381962 print([e for n in range(27) for e in row(n)]) # _Michael S. Branicky_, Mar 12 2025 %Y A381962 Cf. A000120, A078627 (row lengths), A078677 (row sums), A180094. %Y A381962 Cf. A381963, A381965. %K A381962 nonn,tabf,base,easy %O A381962 0,3 %A A381962 _Paolo Xausa_, Mar 11 2025