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!)
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)) 2

%I #7 Mar 07 2016 11:58:29

%S 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 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 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 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 a(n) -> add2c( (n-((trinv(n)*(trinv(n)-1))/2)), (((trinv(n)-1)*(((1/2)*trinv(n))+1))-n) )

%p 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 trinv[n_] := Floor[(1/2)*(Sqrt[8*n + 1] + 1)];

%t Sum2c[a_, b_] := Sum2c[a, b] = If[0 == a || 0 == b, Return[0], Return[ Sum2c[BitXor[a, b], 2*BitAnd[a, b]] + 1]];

%t a[n_] := Sum2c[n - (1/2)*trinv[n]*(trinv[n] - 1), (trinv[n] - 1)*(trinv[ n]/2 + 1) - n];

%t Table[a[n], {n, 0, 120}](* _Jean-François Alcover_, Mar 07 2016, adapted from Maple *)

%Y Cf. A050600, A050602, A003056, A048720 (for the Maple implementation of trinv and XORnos, ANDnos)

%K nonn,tabl

%O 0,12

%A _Antti Karttunen_, Jun 22 1999

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 April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)