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!)
A332017 a(n) is the sum of the squares of the lengths of the runs of consecutive equal digits in the binary representation of n. 1

%I #12 Feb 06 2020 15:36:06

%S 0,1,2,4,5,3,5,9,10,6,4,6,8,6,10,16,17,11,7,9,7,5,7,11,13,9,7,9,13,11,

%T 17,25,26,18,12,14,10,8,10,14,12,8,6,8,10,8,12,18,20,14,10,12,10,8,10,

%U 14,18,14,12,14,20,18,26,36,37,27,19,21,15,13,15,19

%N a(n) is the sum of the squares of the lengths of the runs of consecutive equal digits in the binary representation of n.

%C a(0) = 0 by convention.

%C Every nonnegative number k appears A006456(k) times in the sequence, the last occurrence being at index A000975(k).

%H Rémy Sigrist, <a href="/A332017/b332017.txt">Table of n, a(n) for n = 0..8192</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = Sum_{k = 1..A005811(n)} A101211(n, k)^2.

%F a(A000975(k)) = k for any k >= 0.

%F a(2^k-1) = k^2 for any k >= 0.

%F a(2^k) = k^2+1 for any k >= 0.

%e For n = 49:

%e - the binary representation of 49 is "110001",

%e - we have a run of 2 1's followed by a run of 3 0's followed by a run of 1 1's,

%e - so a(49) = 2^2 + 3^2 + 1^2 = 14.

%o (PARI) a(n) = { my (v=0); while (n, my (r=valuation(n+(n%2),2)); v+=r^2; n\=2^r); v }

%Y Cf. A000975, A005811, A006456, A101211.

%K nonn,look,base

%O 0,3

%A _Rémy Sigrist_, Feb 04 2020

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 May 2 16:14 EDT 2024. Contains 372197 sequences. (Running on oeis4.)