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 A050601 #9 Jun 01 2025 22:51:44 %S A050601 0,0,0,0,1,0,0,1,1,0,0,2,1,2,0,0,1,2,2,1,0,0,2,1,1,1,2,0,0,1,1,1,1,1, %T A050601 1,0,0,3,2,3,1,3,2,3,0,0,1,3,3,2,2,3,3,1,0,0,2,1,3,2,1,2,3,1,2,0,0,1, %U A050601 1,1,2,2,2,2,1,1,1,0,0,3,2,3,1,3,1,3,1,3,2,3,0,0,1,2,2,1,1,2,2,1,1,2,2,1,0,0,2,1,2,1,2,1,1,1,2,1,2,1,2,0 %N A050601 Recursion counts for summation table A003056 with formula a(0,x) = x, a(y,0) = y, a(y,x) = a((y XOR x),2*(y AND x)). %F A050601 a(n) -> add2c( (n-((trinv(n)*(trinv(n)-1))/2)), (((trinv(n)-1)*(((1/2)*trinv(n))+1))-n) ) %p A050601 add2c := proc(a,b) option remember; if((0 = a) or (0 = b)) then RETURN(0); else RETURN(1+add_c(XORnos(a,b),2*ANDnos(a,b))); fi; end; %t A050601 trinv[n_] := Floor[(1/2)*(Sqrt[8*n + 1] + 1)]; %t A050601 Sum2c[a_, b_] := Sum2c[a, b] = If[0 == a || 0 == b, Return[0], Return[ Sum2c[BitXor[a, b], 2*BitAnd[a, b]] + 1]]; %t A050601 a[n_] := Sum2c[n - (1/2)*trinv[n]*(trinv[n] - 1), (trinv[n] - 1)*(trinv[ n]/2 + 1) - n]; %t A050601 Table[a[n], {n, 0, 120}](* _Jean-François Alcover_, Mar 07 2016, adapted from Maple *) %Y A050601 Cf. A050600, A050602, A003056, A048720 (for the Maple implementation of trinv and XORnos, ANDnos) %K A050601 nonn,tabl %O A050601 0,12 %A A050601 _Antti Karttunen_, Jun 22 1999