close
login
A166751
Even positive integers in which, when written in binary, each run of 0's is of exactly the same length as the run of 1's immediately before it.
5
2, 10, 12, 42, 44, 50, 56, 170, 172, 178, 184, 202, 204, 226, 240, 682, 684, 690, 696, 714, 716, 738, 752, 810, 812, 818, 824, 906, 908, 962, 992, 2730, 2732, 2738, 2744, 2762, 2764, 2786, 2800, 2858, 2860, 2866, 2872, 2954, 2956, 3010, 3040, 3242, 3244, 3250, 3256
OFFSET
1,1
COMMENTS
Each term, when written in binary, contains an even number of digits, obviously.
The runs of 0's in the n-th term form the composition in the n-th row of A228369. - John Tyler Rascoe, Sep 05 2024
LINKS
EXAMPLE
The first 7 terms written in binary: 10, 1010, 1100, 101010, 101100, 110010, 111000.
From Paolo Xausa, Aug 28 2025: (Start)
Terms can be arranged in an irregular triangle, where row n >= 1 has length 2^(n-1), row sum A386705(n), and lists all the terms with bit length 2*n:
2;
10, 12;
42, 44, 50, 56;
170, 172, 178, 184, 202, 204, 226, 240;
682, 684, 690, 696, 714, 716, 738, 752, 810, 812, 818, 824, 906, 908, 962, 992;
... (End)
MATHEMATICA
A166751row[n_] := With[{b = Array[IntegerDigits[4^# - 2^#, 2] &, n]}, Sort[Flatten[Map[FromDigits[Flatten[#], 2] &, Map[b[[#]] &, Map[Permutations, IntegerPartitions[n]], {2}], {2}]]]]; (* Generates terms with bit length = 2*n *)
Array[A166751row, 6] (* Paolo Xausa, Aug 28 2025 *)
PROG
(Python)
from itertools import groupby
def ok(n):
L = [len(list(g)) for k, g in groupby(bin(n)[2:])]
return (m:=len(L))&1 == 0 and all(L[2*j] == L[2*j+1] for j in range(m>>1))
print([k for k in range(10**4) if ok(k)]) # Michael S. Branicky, Aug 25 2025
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Oct 21 2009
EXTENSIONS
Extended by Ray Chandler, Mar 11 2010
STATUS
approved