Original entry on oeis.org
1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 13, 11, 14, 15, 21, 12, 16, 17, 22, 18, 23, 24, 34, 19, 25, 26, 35, 27, 36, 37, 55, 20, 28, 29, 38, 30, 39, 40, 56, 31, 41, 42, 57, 43, 58, 59, 89, 32, 44, 45, 60, 46, 61, 62, 90, 47, 63, 64, 91, 65, 92, 93, 144, 33, 48, 49, 66
Offset: 1
-
a(n) = my(L = logint(n, 2), wt = hammingweight(n), A = L + wt, m = 0); fibonacci(A+1) + sum(i=1, L, binomial(i-1, A-i)) + sum(j=0, L-1, if(bittest(n, j), m++; binomial(j, m)))
A226080
Denominators in the Fibonacci (or rabbit) ordering of the positive rational numbers.
Original entry on oeis.org
1, 1, 1, 2, 1, 3, 2, 1, 4, 3, 2, 3, 1, 5, 4, 3, 4, 2, 5, 3, 1, 6, 5, 4, 5, 3, 7, 4, 2, 7, 5, 3, 5, 1, 7, 6, 5, 6, 4, 9, 5, 3, 10, 7, 4, 7, 2, 9, 7, 5, 7, 3, 8, 5, 1, 8, 7, 6, 7, 5, 11, 6, 4, 13, 9, 5, 9, 3, 13, 10, 7, 10, 4, 11, 7, 2, 11, 9, 7, 9, 5, 12, 7
Offset: 1
The denominators are read from the rationals listed in "rabbit order":
1/1, 2/1, 3/1, 1/2, 4/1, 1/3, 3/2, 5/1, 1/4, 4/3, 5/2, 2/3, 6/1, ...
-
z = 10; g[1] = {1}; g[2] = {2}; g[3] = {3, 1/2};
j[3] = Join[g[1], g[2], g[3]]; j[n_] := Join[j[n - 1], g[n]];
d[s_List, t_List] := Part[s, Sort[Flatten[Map[Position[s, #] &, Complement[s, t]]]]]; j[3] = Join[g[1], g[2], g[3]]; n = 3; While[n <= z, n++; g[n] = d[Riffle[g[n - 1] + 1, 1/g[n - 1]], g[n - 2]]];
Table[g[n], {n, 1, z}]; j[z] (* rabbit-ordered rationals *)
Denominator[j[z]] (* A226080 *)
Numerator[j[z]] (* A226081 *)
Flatten[NestList[(# /. x_ /; x > 1 -> Sequence[x, 1/x - 1]) + 1 &, {1}, 9]] (* rabbit-ordered rationals, Danny Marmer, Dec 07 2014 *)
-
A226080_vec(N=100)={my(T=[1],S=T,A=T); while(N>#A=concat(A, apply(denominator, T=select(t->!setsearch(S,t), concat(apply(t->[t+1,1/t],T))))), S=setunion(S,Set(T)));A} \\ M. F. Hasler, Nov 30 2018
-
(A226080(n)=denominator(RabbitOrderedRational(n))); ROR=List(1); RabbitOrderedRational(n)={if(n>#ROR, local(S=Set(ROR), i=#ROR*2\/(sqrt(5)+1), a(t)=setsearch(S,t)||S=setunion(S,[listput(ROR,t)])); until( type(ROR[i+=1])=="t_INT" && n<=#ROR, a(ROR[i]+1); a(1/ROR[i])));ROR[n]} \\ M. F. Hasler, Nov 30 2018
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
A243848
Irregular triangular array of denominators of the positive rational numbers ordered as in Comments.
Original entry on oeis.org
1, 1, 1, 1, 3, 1, 3, 2, 1, 3, 2, 5, 5, 1, 3, 2, 5, 5, 3, 4, 3, 1, 3, 2, 5, 5, 3, 4, 7, 11, 5, 11, 7, 1, 3, 2, 5, 5, 3, 4, 7, 11, 5, 11, 7, 7, 7, 6, 8, 7, 7, 4, 1, 3, 2, 5, 5, 3, 4, 7, 11, 5, 11, 7, 7, 7, 6, 8, 7, 9, 17, 4, 9, 21, 17, 11, 5, 17, 21, 9, 17, 9
Offset: 1
First 6 rows of the array of rationals:
1/1
2/1
3/1
4/1 ... 2/3
5/1 ... 5/3 ... 1/2
6/1 ... 8/3 ... 3/2 ... 6/5 ... 2/5
The denominators, by rows: 1,1,1,1,3,1,3,2,1,3,3,2,5,5.
-
z = 12; g[1] = {1}; f1[x_] := x + 1; f2[x_] := 2/x; h[1] = g[1];
b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
u = Table[Reverse[g[n]], {n, 1, z}]; v = Flatten[u];
Denominator[v] (* A243848 *)
Numerator[v] (* A243849 *)
Table[Length[g[n]], {n, 1, z}] (* A243850 *)
A243572
Irregular triangular array generated as in Comments; contains every positive integer exactly once.
Original entry on oeis.org
1, 2, 3, 4, 6, 9, 5, 7, 10, 12, 18, 27, 8, 11, 13, 15, 19, 21, 28, 30, 36, 54, 81, 14, 16, 20, 22, 24, 29, 31, 33, 37, 39, 45, 55, 57, 63, 82, 84, 90, 108, 162, 243, 17, 23, 25, 32, 34, 38, 40, 42, 46, 48, 56, 58, 60, 64, 66, 72, 83, 85, 87, 91, 93, 99, 109
Offset: 1
First 5 rows of the array:
1
2 ... 3
4 ... 6 ... 9
5 ... 7 ... 10 .. 12 .. 18 .. 27
8 ... 11 .. 13 .. 15 .. 19 .. 21 .. 28 .. 30 .. 36 .. 54 .. 81
-
z = 10; g[1] = {1}; f1[x_] := x + 1; f2[x_] := 3 x; h[1] = g[1];
b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
u = Table[g[n], {n, 1, z}]; v = Flatten[u] (* A243572 *)
A243573
Irregular triangular array generated as in Comments; contains every positive integer exactly once.
Original entry on oeis.org
1, 2, 4, 3, 5, 8, 16, 6, 9, 12, 17, 20, 32, 64, 7, 10, 13, 18, 21, 24, 33, 36, 48, 65, 68, 80, 128, 256, 11, 14, 19, 22, 25, 28, 34, 37, 40, 49, 52, 66, 69, 72, 81, 84, 96, 129, 132, 144, 192, 257, 260, 272, 320, 512, 1024, 15, 23, 26, 29, 35, 38, 41, 44, 50
Offset: 1
First 5 rows of the array:
1
2 .. 4
3 .. 5 .. 8 .. 16
6 .. 9 .. 12 . 17 . 20 . 32 . 64
7 .. 10 . 13 . 18 . 21 . 24 . 33 . 36 . 48 . 65 . 68 . 80 . 128 . 256
-
z = 8; g[1] = {1}; f1[x_] := x + 1; f2[x_] := 4 x; h[1] = g[1];
b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
u = Table[g[n], {n, 1, z}]; v = Flatten[u] (* A243573 *)
A243849
Irregular triangular array of numerators of the positive rational numbers ordered as in Comments.
Original entry on oeis.org
1, 2, 3, 4, 2, 5, 5, 1, 6, 8, 3, 6, 2, 7, 11, 5, 11, 7, 4, 3, 1, 8, 14, 7, 16, 12, 7, 7, 10, 10, 4, 6, 2, 9, 17, 9, 21, 17, 10, 11, 17, 21, 9, 17, 9, 8, 6, 5, 5, 4, 3, 1, 10, 20, 11, 26, 22, 13, 15, 24, 32, 14, 28, 16, 15, 13, 11, 13, 11, 14, 22, 5, 10, 22
Offset: 1
First 6 rows of the array of rationals:
1/1
2/1
3/1
4/1 ... 2/3
5/1 ... 5/3 ... 1/2
6/1 ... 8/3 ... 3/2 ... 6/5 ... 2/5
The numerators, by rows: 1,2,3,4,2,5,5,1,6,8,7,3,6,2.
-
z = 12; g[1] = {1}; f1[x_] := x + 1; f2[x_] := 2/x; h[1] = g[1];
b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
u = Table[Reverse[g[n]], {n, 1, z}]; v = Flatten[u];
Denominator[v] (* A243848 *)
Numerator[v] (* A243849 *)
Table[Length[g[n]], {n, 1, z}] (* A243850 *)
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
A243610
Irregular triangular array of all the integers, each exactly once, ordered as in Comments.
Original entry on oeis.org
1, 0, 2, -1, 4, -3, -2, 8, -7, -6, -4, 3, 16, -15, -14, -12, -8, 5, 6, 7, 32, -31, -30, -28, -24, -16, -5, 9, 10, 12, 13, 14, 15, 64, -63, -62, -60, -56, -48, -32, -13, -11, -10, -9, 17, 18, 20, 24, 25, 26, 28, 29, 30, 31, 128, -127, -126, -124, -120, -112
Offset: 1
First 7 rows of the array:
1
0 .... 2
-1 ... 4
-3 ... -2 ... 8
-7 ... -6 ... -4 ... 3 .... 16
-15 .. -14 .. -12 .. -8 ... 5 .... 6 ... 7 .. 32
-31 .. -30 .. -28 .. -24 .. -16 .. -5 .. 9 .. 10 . 12 . 13 . 14 . 15 . 64
-
z = 12; g[1] = {1}; f1[x_] := 2 x; f2[x_] := 1 - x; h[1] = g[1];
b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
u = Table[g[n], {n, 1, 12}]
v = Flatten[u]
A350603
Irregular triangle read by rows: row n lists the elements of the set S_n in increasing order, where S_0 = {0}, and S_n is obtained by applying the operations x -> x+1 and x -> 2*x to S_{n-1}.
Original entry on oeis.org
0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 20, 24, 32, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 32, 33, 34, 36, 40, 48, 64
Offset: 0
The first few sets S_n are:
[0],
[0, 1],
[0, 1, 2],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4, 5, 6, 8],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 20, 24, 32],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 32, 33, 34, 36, 40, 48, 64],
...
-
T:= proc(n) option remember; `if`(n=0, 0,
sort([map(x-> [x+1, 2*x][], {T(n-1)})[]])[])
end:
seq(T(n), n=0..8); # Alois P. Heinz, Jan 12 2022
-
T[n_] := T[n] = If[n==0, {0}, {#+1, 2#}& /@ T[n-1] // Flatten //
Union];
Table[T[n], {n, 0, 8}] // Flatten (* Jean-François Alcover, May 06 2022, after Alois P. Heinz *)
-
from itertools import chain, islice
def A350603_gen(): # generator of terms
s = {0}
while True:
yield from sorted(s)
s = set(chain.from_iterable((x+1,2*x) for x in s))
A350603_list = list(islice(A350603_gen(),30)) # Chai Wah Wu, Jan 12 2022
Definition made more precise by
Chai Wah Wu, Jan 12 2022
Showing 1-10 of 10 results.
Comments