OFFSET
1,2
LINKS
Jason Kimberley, Table of n, a(n) for n = 1..5000
EXAMPLE
23 in binary is 10111. There is a run of one 1, followed by a run of one 0, followed finally by a run of three 1's. So, a(23) = a(1)+a(1)+a(3) = 1+1+2 = 4.
PROG
(Magma)
runs := function(s)
r := []; c := 1;
for i in [1..#s-1] do
if s[i] eq s[i+1]
then c +:= 1;
else Append(~r, c); c := 1;
end if;
end for;
Append(~r, c);
return r;
end function;
A175453 := func<n|n eq 1 select 1 else
&+[$$(k):k in runs(b)]where b is IntegerToSequence(n, 2)>;
// Jason Kimberley, Feb 11 2013
CROSSREFS
KEYWORD
base,nonn,easy
AUTHOR
Leroy Quet, May 16 2010
EXTENSIONS
Extended by Jason Kimberley, Feb 11 2013
STATUS
approved