cp's OEIS Frontend

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.

A323456 Irregular triangle read by rows: row n lists the numbers that can be obtained from the binary expansion of n by either deleting a single 0, or inserting a single 0 after any 1.

This page as a plain text file.
%I A323456 #29 Oct 26 2023 17:39:44
%S A323456 2,1,4,5,6,2,8,3,9,10,3,10,12,11,13,14,4,16,5,17,18,5,6,18,20,7,19,21,
%T A323456 22,6,20,24,7,21,25,26,7,22,26,28,23,27,29,30,8,32,9,33,34,9,10,34,36,
%U A323456 11,35,37,38,10,12,36,40,11,13,37,41,42,11,14,38,42,44
%N A323456 Irregular triangle read by rows: row n lists the numbers that can be obtained from the binary expansion of n by either deleting a single 0, or inserting a single 0 after any 1.
%C A323456 All the numbers in row n have the same binary weight (A000120) as n.
%C A323456 If k appears in row n, n appears in row k.
%C A323456 If we form a graph on the positive integers by joining k to n if k appears in row n, then there is a connected component for each weight 1, 2, , ...
%C A323456 The smallest number in the component containing n is 2^A000120(n)-1, and n is reachable from 2^A000120(n)-1 in A023416(n) steps. - _Rémy Sigrist_, Jan 17 2019
%H A323456 Rémy Sigrist, <a href="/A323456/b323456.txt">Rows n = 1..1000, flattened</a>
%e A323456 From 6 = 110 we can get 11 = 3, 1010 = 10, or 1100 = 12, so row 6 is {3,10,12}.
%e A323456 From 7 = 111 we can get 1011 = 11, 1101 = 13, or 1110 = 14, so row 7 is {11,13,14}.
%e A323456 The triangle begins:
%e A323456   2,
%e A323456   1, 4,
%e A323456   5, 6,
%e A323456   2, 8,
%e A323456   3, 9, 10,
%e A323456   3, 10, 12,
%e A323456   11, 13, 14,
%e A323456   4, 16,
%e A323456   5, 17, 18,
%e A323456   5, 6, 18, 20,
%e A323456   7, 19, 21, 22,
%e A323456   ...
%t A323456 r323456[n_] := Module[{digs=IntegerDigits[n, 2]} ,Map[FromDigits[#, 2]&, Union[Map[Insert[digs, 0, #+1]&, Flatten[Position[digs, 1]]], Map[Drop[digs, {#}]&, Flatten[Position[digs, 0]]]]]] (* nth row *)
%t A323456 a323456[{m_, n_}] := Flatten[Map[r323456, Range[m, n]]]
%t A323456 a323456[{1,22}] (* _Hartmut F. W. Hoft_, Oct 24 2023 *)
%o A323456 (PARI) row(n) = { my (r=Set(), w=0, s=0); while (n, my (v=1+valuation(n,2)); r = setunion(r, Set(n*2^(w+1)+s)); if (v>1, r = setunion(r, Set(n*2^(w-1)+s))); s += (n%(2^v))*2^w; w += v; n \= 2^v); r } \\ _Rémy Sigrist_, Jan 27 2019
%o A323456 (Python)
%o A323456 def row(n):
%o A323456     b = bin(n)[2:]
%o A323456     s1 = set(b[:i+1] + "0" + b[i+1:] for i in range(len(b)) if b[i] == "1")
%o A323456     s2 = set(b[:i] + b[i+1:] for i in range(len(b)) if b[i] == "0")
%o A323456     return sorted(int(w, 2) for w in s1 | s2)
%o A323456 print([c for n in range(1, 23) for c in row(n)]) # _Michael S. Branicky_, Jul 24 2022
%Y A323456 Cf. A000120, A323455, A323465.
%Y A323456 This is a base-2 analog of A323286.
%K A323456 nonn,tabf,base
%O A323456 1,1
%A A323456 _N. J. A. Sloane_, Jan 17 2019
%E A323456 More terms from _Rémy Sigrist_, Jan 27 2019