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
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, 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, 14, 18, 14, 12, 14, 20, 18, 26, 36, 37, 27, 19, 21, 15, 13, 15, 19 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
a(0) = 0 by convention.
Every nonnegative number k appears A006456(k) times in the sequence, the last occurrence being at index A000975(k).
LINKS
FORMULA
a(n) = Sum_{k = 1..A005811(n)} A101211(n, k)^2.
a(A000975(k)) = k for any k >= 0.
a(2^k-1) = k^2 for any k >= 0.
a(2^k) = k^2+1 for any k >= 0.
EXAMPLE
For n = 49:
- the binary representation of 49 is "110001",
- we have a run of 2 1's followed by a run of 3 0's followed by a run of 1 1's,
- so a(49) = 2^2 + 3^2 + 1^2 = 14.
PROG
(PARI) a(n) = { my (v=0); while (n, my (r=valuation(n+(n%2), 2)); v+=r^2; n\=2^r); v }
CROSSREFS
Sequence in context: A021807 A284561 A061728 * A276127 A182115 A362962
KEYWORD
nonn,look,base
AUTHOR
Rémy Sigrist, Feb 04 2020
STATUS
approved

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 20 10:17 EDT 2024. Contains 371814 sequences. (Running on oeis4.)