This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A166751 #28 Aug 28 2025 22:08:35 %S A166751 2,10,12,42,44,50,56,170,172,178,184,202,204,226,240,682,684,690,696, %T A166751 714,716,738,752,810,812,818,824,906,908,962,992,2730,2732,2738,2744, %U A166751 2762,2764,2786,2800,2858,2860,2866,2872,2954,2956,3010,3040,3242,3244,3250,3256 %N 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. %C A166751 Each term, when written in binary, contains an even number of digits, obviously. %C A166751 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 %H A166751 John Tyler Rascoe, <a href="/A166751/b166751.txt">Table of n, a(n) for n = 1..8192</a> %e A166751 The first 7 terms written in binary: 10, 1010, 1100, 101010, 101100, 110010, 111000. %e A166751 From _Paolo Xausa_, Aug 28 2025: (Start) %e A166751 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: %e A166751 2; %e A166751 10, 12; %e A166751 42, 44, 50, 56; %e A166751 170, 172, 178, 184, 202, 204, 226, 240; %e A166751 682, 684, 690, 696, 714, 716, 738, 752, 810, 812, 818, 824, 906, 908, 962, 992; %e A166751 ... (End) %t A166751 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 *) %t A166751 Array[A166751row, 6] (* _Paolo Xausa_, Aug 28 2025 *) %o A166751 (Python) %o A166751 from itertools import groupby %o A166751 def ok(n): %o A166751 L = [len(list(g)) for k, g in groupby(bin(n)[2:])] %o A166751 return (m:=len(L))&1 == 0 and all(L[2*j] == L[2*j+1] for j in range(m>>1)) %o A166751 print([k for k in range(10**4) if ok(k)]) # _Michael S. Branicky_, Aug 25 2025 %Y A166751 Cf. A066099, A164707, A175413, A228369, A386705. %K A166751 base,nonn,changed %O A166751 1,1 %A A166751 _Leroy Quet_, Oct 21 2009 %E A166751 Extended by _Ray Chandler_, Mar 11 2010