A227737 n occurs as many times as there are runs in binary representation of n.
1, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 26, 26
Offset: 1
Examples
1 has one run in its binary representation "1", thus 1 occurs once. 2 has two runs in its binary representation "10", thus 2 occurs twice. 3 has one run in its binary representation "11", thus 3 occurs only once. 4 has two runs in its binary representation "100", thus 4 occurs twice. 5 has three runs in its binary representation "101", thus 5 occurs three times. The sequence thus begins as 1, 2,2, 3, 4,4, 5,5,5, ...
Links
- Antti Karttunen, Table of n, a(n) for n = 1..5120
Programs
-
Mathematica
Table[ConstantArray[n, Length@ Split@ IntegerDigits[n, 2]], {n, 26}] // Flatten (* Michael De Vlieger, May 09 2017 *) Table[PadRight[{},Length[Split[IntegerDigits[n,2]]],n],{n,40}]//Flatten (* Harvey P. Dale, Jul 23 2021 *)
Comments