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.
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
Examples
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).
Links
- 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
Crossrefs
Programs
-
Maple
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
-
Mathematica
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 *)
-
Python
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
Comments