OFFSET
1,1
COMMENTS
All the numbers in row n have the same binary weight (A000120) as n.
If k appears in row n, n appears in row k.
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, , ...
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
LINKS
Rémy Sigrist, Rows n = 1..1000, flattened
EXAMPLE
From 6 = 110 we can get 11 = 3, 1010 = 10, or 1100 = 12, so row 6 is {3,10,12}.
From 7 = 111 we can get 1011 = 11, 1101 = 13, or 1110 = 14, so row 7 is {11,13,14}.
The triangle begins:
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, 22,
...
MATHEMATICA
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 *)
a323456[{m_, n_}] := Flatten[Map[r323456, Range[m, n]]]
a323456[{1, 22}] (* Hartmut F. W. Hoft, Oct 24 2023 *)
PROG
(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
(Python)
def row(n):
b = bin(n)[2:]
s1 = set(b[:i+1] + "0" + b[i+1:] for i in range(len(b)) if b[i] == "1")
s2 = set(b[:i] + b[i+1:] for i in range(len(b)) if b[i] == "0")
return sorted(int(w, 2) for w in s1 | s2)
print([c for n in range(1, 23) for c in row(n)]) # Michael S. Branicky, Jul 24 2022
CROSSREFS
KEYWORD
nonn,tabf,base
AUTHOR
N. J. A. Sloane, Jan 17 2019
EXTENSIONS
More terms from Rémy Sigrist, Jan 27 2019
STATUS
approved