A232559
Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x are in S, and duplicates are deleted as they occur.
Original entry on oeis.org
1, 2, 3, 4, 6, 5, 8, 7, 12, 10, 9, 16, 14, 13, 24, 11, 20, 18, 17, 32, 15, 28, 26, 25, 48, 22, 21, 40, 19, 36, 34, 33, 64, 30, 29, 56, 27, 52, 50, 49, 96, 23, 44, 42, 41, 80, 38, 37, 72, 35, 68, 66, 65, 128, 31, 60, 58, 57, 112, 54, 53, 104, 51, 100, 98, 97
Offset: 1
Each x begets x + 1 and 2*x, but if either has already occurred it is deleted. Thus, 1 begets 2, which begets (3,4); from which 3 begets only 6, and 4 begets (5,8).
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Clark Kimberling)
- Katherine E. Stange, The Intuition behind the Double-And-Add / Square-And-Multiply Algorithm, YouTube video, 2021.
- Dimitri Zucker, I Found a Simple Pattern That Encodes Different Bases, YouTube video, 2024. (Adds 0 above the root of the tree, and shows how to reconstruct the tree backwards from child nodes)
- Robert Munafo, Sequences A232559 and A232561, Spanning Trees of N
- Index entries for sequences that are permutations of the natural numbers
-
a:= proc() local l, s; l, s:= [1], {1}:
proc(n) option remember; local i, r; r:= l[1];
l:= subsop(1=NULL, l);
for i in [1+r, r+r] do if not i in s then
l, s:=[l[], i], s union {i} fi
od; r
end
end():
seq(a(n), n=1..100); # Alois P. Heinz, Aug 06 2017
-
z = 12; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1]]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]] (* this sequence *)
Table[Length[g1[n]], {n, 1, z}] (* Fibonacci numbers *)
t1 = Flatten[Table[Position[t, n], {n, 1, 200}]] (* A232560 *)
-
def aupton(terms):
alst, S, expand = [1, 2], {1, 2}, [2]
while len(alst) < terms:
x = expand.pop(0)
new_elts = [y for y in [x+1, 2*x] if y not in S]
alst.extend(new_elts); expand.extend(new_elts); S.update(new_elts)
return alst[:terms]
print(aupton(66)) # Michael S. Branicky, Sep 14 2021
A232561
Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then x + 1 and 3*x are in S, and duplicates are deleted as they occur.
Original entry on oeis.org
1, 2, 3, 6, 4, 9, 7, 18, 5, 12, 10, 27, 8, 21, 19, 54, 15, 13, 36, 11, 30, 28, 81, 24, 22, 63, 20, 57, 55, 162, 16, 45, 14, 39, 37, 108, 33, 31, 90, 29, 84, 82, 243, 25, 72, 23, 66, 64, 189, 60, 58, 171, 56, 165, 163, 486, 17, 48, 46, 135, 42, 40, 117, 38
Offset: 1
Each x begets x + 1 and 3*x, but if either has already occurred it is deleted. Thus, 1 begets 2 and 3; in the next generation, 2 begets only 6, and 3 begets 4 and 9.
-
z = 8; g[1] = {1}; g[2] = {2, 3};
g[n_] := Riffle[g[n - 1] + 1, 3 g[n - 1]]
j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]];
g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]];
g1[1] = g[1]; g1[2] = g[2];
t = Flatten[Table[g1[n], {n, 1, z}]] (* A232561 *)
Table[Length[g1[n]], {n, 1, z}] (* A001590 *)
t1 = Flatten[Table[Position[t, n], {n, 1, 200}]] (* A232562 *)
A345253
Maximal Fibonacci tree: Arrangement of the positive integers as labels of a complete binary tree.
Original entry on oeis.org
1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 13, 11, 14, 16, 21, 12, 15, 17, 22, 18, 23, 26, 34, 19, 24, 27, 35, 29, 37, 42, 55, 20, 25, 28, 36, 30, 38, 43, 56, 31, 39, 44, 57, 47, 60, 68, 89, 32, 40, 45, 58, 48, 61, 69, 90, 50, 63, 71, 92, 76, 97, 110, 144, 33, 41, 46, 59, 49
Offset: 1
As a complete binary tree:
1
/ \
2 3
/ \ / \
4 5 6 8
/ \ / \ / \ / \
7 9 10 13 11 14 16 21
/ \ / \ / \ / \ / \ / \ / \ / \
...
By maximal Fibonacci expansion:
F(1)
/ \
F(1) + F(2) F(1) + F(3)
/ \ / \
F(1) + F(2) + F(3) F(1) + F(2) + F(4) F(1) + F(3) + F(4) F(1) + F(3) + F(5)
...
"Fibonacci gaps," or differences between successive indices in maximal Fibonacci expansion above, are A007931(n-1) for n > 1 (see link):
*
/ \
1 2
/ \ / \
11 12 21 22
/ \ / \ / \ / \
111 112 121 122 211 212 221 222
/ \ / \ / \ / \ / \ / \ / \ / \
...
In examples of the three methods below:
Branch left-right-right down the tree to arrive at nodal position n = 2*(2*(2*1) + 1) + 1 = 11;
Branch right-left-left down the tree to arrive at nodal position n = 2*(2*(2*1 + 1)) = 12.
Tree by inner composition of (one plus) the lower and upper Wythoff sequences, A000201 and A001950 (Method 1):
a(11) = A000201(A001950(A001950(1) + 1) + 1) + 1 = 13.
a(12) = A001950(A000201(A000201(1) + 1) + 1) + 1 = 11.
Tree by (outer) composition of branching functions L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1), where F(n) = A000045(n) and Finv(n) = A130233(n) (Method 2):
a(11) = R(R(L(1))) = 13.
a(12) = L(R(R(1))) = 11.
Tree by outer composition of A060143 and A060144 (Wythoff inverse sequences) (Method 3):
a(11) = 13, position of first nonzero in A060144(A060144(A060143(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
a(12) = 11, position of first nonzero in A060143(A060143(A060144(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
Cf.
A000045,
A000201,
A001950,
A007931,
A020988,
A020989,
A026351,
A026352,
A029837,
A048680,
A049651,
A059893,
A061547,
A070939,
A081242,
A083047,
A095903,
A099919,
A112310,
A113473,
A130233,
A200648,
A232560,
A243571,
A255773,
A255774,
A329395,
A343152,
A345252,
A345254.
-
(* For binary tree implementations, see supporting file under LINKS *)
a[n_] := (x = 0; y = 0; BDn = Reverse[IntegerDigits[n, 2]]; imax = Length[BDn] - 1; For[i = 0, i <= imax, i++, {x, y} = {y + 1, x + y}; If[BDn[[i + 1]] == 1, {x, y} = {y, x + y}]]; y);
(* Adapted from PARI code of Kevin Ryde *)
-
a(n) = my(x=0,y=0); for(i=0,logint(n,2), [x,y]=[y+1,x+y]; if(bittest(n,i), [x,y]=[y,x+y])); y; \\ Kevin Ryde, Jun 19 2021
A345252
2-1-Fibonacci cohort array, a rectangular array T(n,k) read by downward antidiagonals.
Original entry on oeis.org
1, 2, 3, 4, 6, 5, 7, 11, 10, 8, 12, 19, 18, 16, 9, 20, 32, 31, 29, 17, 13, 33, 53, 52, 50, 30, 26, 14, 54, 87, 86, 84, 51, 47, 27, 15, 88, 142, 141, 139, 85, 81, 48, 28, 21, 143, 231, 230, 228, 140, 136, 82, 49, 42, 22, 232, 375, 374, 372, 229, 225, 137, 83, 76
Offset: 1
Northwest corner of {T(n,k)}:
k=1 k=2 k=3 k=4 k=5 k=6 ...
n=0: 1, 2, 4, 7, 12, 20, ...
n=1: 3, 6, 11, 19, 32, 53, ...
n=2: 5, 10, 18, 31, 52, 86, ...
n=3: 8, 16, 29, 50, 84, 139, ...
n=4: 9, 17, 30, 51, 85, 140, ...
...
Northwest corner of {T(n,k)} in maximal Fibonacci expansion (see link):
k=1 k=2 k=3 ...
n=0: F(1), F(1)+F(2), F(1)+F(2)+F(3), ...
n=1: F(1)+F(3), F(1)+F(3)+F(4), F(1)+F(3)+F(4)+F(5), ...
n=2: F(1)+F(2)+F(4), F(1)+F(2)+F(4)+F(5), F(1)+F(2)+F(4)+F(5)+F(6), ...
...
Northwest corner of {T(n,k)} as "Fibonacci gaps," or differences between successive indices in maximal Fibonacci expansion above, (see link):
k=1 k=2 k=3 k=4 k=5 k=6 ...
n=0: *, 1, 11, 111, 1111, 11111, ...
n=1: 2, 21, 211, 2111, 21111, 211111, ...
n=2: 12, 121, 1211, 12111, 121111, 1211111, ...
n=3: 22, 221, 2211, 22111, 221111, 2211111, ...
n=4: 122, 1221, 12211, 122111, 1221111, 12211111, ...
...
Cf.
A000027,
A000045,
A000071,
A000201,
A001950,
A035513,
A059893,
A083047,
A130233,
A132817,
A191436,
A194030,
A232560,
A345253,
A345254.
-
(* Define A000045 *)
F[n_] := Fibonacci[n]
(* Defined A130233 *)
Finv[n_] := Floor[Log[GoldenRatio, Sqrt[5]n + 1]]
(* Simplified Formula *)
MatrixForm[Table[n + F[Finv[n] + k + 2] - F[Finv[n] + 2], {n, 0, 4}, {k, 1, 6}]]
(* Branching Formula *)
MatrixForm[Table[NestList[Function[# + F[Finv[#]]], n + F[Finv[n] + 1], 5], {n, 0, 4}]]
Showing 1-4 of 4 results.
Comments