A161919 Permutation of natural numbers: concatenation of subsequences A161924(A000070(k-1)..A026905(k)), k >= 1, each sorted into ascending order.
1, 2, 3, 4, 5, 7, 6, 8, 9, 11, 15, 10, 13, 16, 17, 19, 23, 31, 12, 14, 18, 21, 27, 32, 33, 35, 39, 47, 63, 20, 22, 25, 29, 34, 37, 43, 55, 64, 65, 67, 71, 79, 95, 127, 24, 26, 30, 36, 38, 41, 45, 51, 59, 66, 69, 75, 87, 111, 128, 129, 131, 135, 143, 159, 191, 255, 28, 40
Offset: 1
Examples
This can be viewed as an irregular table, where row r (>= 1) has A000041(r) elements, i.e., as 1; 2,3; 4,5,7; 6,8,9,11,15; 10,13,16,17,19,23,31; etc. A125106 illustrates how each number is mapped to a partition.
Links
- Alois P. Heinz, Rows n = 1..28 (first 18 rows from A. Karttunen)
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Maple
n := 11: s := proc (b) local t, i, j: t := 0: for i to nops(b) do for j from i+1 to nops(b) do if b[j]-b[i] = 1 then t := t+1 else end if end do end do: t end proc: A[n] := {}: for i to 2^n do a[i] := convert(2*i, base, 2) end do: for k to 2^n do if s(a[k]) = n then A[n] := `union`(A[n], {k}) else end if end do: A[n]; # Emeric Deutsch, Feb 26 2016 # second Maple program: f:= proc(l) local i, r; r:= 0; for i to nops(l)-1 do r:= 2*((x-> 2*x+1)@@(l[i+1]-l[i]))(r) od; r/2 end: b:= proc(n, i) `if`(n=0 or i=1, [[0, 1$n]], [b(n, i-1)[], `if`(i>n, [], map(x-> [x[], i], b(n-i, i)))[]]) end: T:= n-> sort(map(f, b(n$2)))[]: seq(T(n), n=1..10); # Alois P. Heinz, Jul 25 2017 # 3rd Maple program: m := 10; with(combinat): ff := proc (X) local s: s := [1, seq(0, j = 1 .. X[2])]: s := map(convert, s, string): return cat(op(s)) end proc: partovi := proc (P) local X, n, Y, i: X := convert(P, multiset): n := X[-1][1]: Y := map(proc (t) options operator, arrow: t[1] end proc, X): for i to n do if member(i, Y) = false then X := [op(X), [i, 0]] end if end do: X := sort(X, proc (s, t) options operator, arrow: evalb(s[1] < t[1]) end proc): X := map(ff, X): X := cat(op(X)): n := parse(X): n := convert(n, decimal, binary): (1/2)*n end proc: for n to m do {seq(partovi(partition(n)[q]), q = 1 .. numbpart(n))} end do; # Emeric Deutsch, Aug 31 2017
-
Mathematica
columns = 10; row[n_] := n - 2^Floor[Log2[n]]; col[0] = 0; col[n_] := If[EvenQ[n], col[n/2] + DigitCount[n/2, 2, 1], col[(n-1)/2] + 1]; Clear[T]; T[, ] = 0; Do[T[row[k], col[k]] = k, {k, 1, 2^columns}]; Table[DeleteCases[Sort @ Table[T[n-1, k], {n, 1, 2^(k-1)}], 0], {k, 1, columns}] // Flatten (* Jean-François Alcover, Feb 16 2021 *)
Extensions
Edited and extended by Antti Karttunen, Oct 12 2009
Comments