A208233 First inverse function (numbers of rows) for pairing function A188568.
1, 1, 2, 3, 2, 1, 1, 3, 2, 4, 5, 2, 3, 4, 1, 1, 5, 3, 4, 2, 6, 7, 2, 5, 4, 3, 6, 1, 1, 7, 3, 5, 4, 6, 2, 8, 9, 2, 7, 4, 5, 6, 3, 8, 1, 1, 9, 3, 7, 5, 6, 4, 8, 2, 10, 11, 2, 9, 4, 7, 6, 5, 8, 3, 10, 1
Offset: 1
Examples
The start of the sequence as triangle array read by rows: 1; 1,2; 3,2,1; 1,3,2,4; 5,2,3,41; 1,5,3,4,2,6; 7,2,5,4,3,6,1; ... Row number k contains permutation numbers form 1 to k.
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
Crossrefs
Cf. A188568.
Programs
-
Python
t=int((math.sqrt(8*n-7) - 1)/ 2) i=n-t*(t+1)/2 j=(t*t+3*t+4)/2-n if i>=j: result= max(i,j)*((-1)**i+1)/2-min(i,j)*((-1)**i-1)/2 else: result=-max(i,j)*((-1)**j-1)/2+min(i,j)*((-1)**j+1)/2
Formula
a(n) = max(i,j)*((-1)^i+1)/2-min(i,j)*((-1)^i-1)/2, if i>=j
a(n) = -max(i,j)*((-1)^j-1)/2+min(i,j)*((-1)^j+1)/2, if i
where
t = floor((-1+sqrt(8*n-7))/2),
i = n-t*(t+1)/2,
j = (t*t+3*t+4)/2-n.
A208234 Second inverse function (numbers of columns) for pairing function A188568.
1, 2, 1, 1, 2, 3, 4, 2, 3, 1, 1, 4, 3, 2, 5, 6, 2, 4, 3, 5, 1, 1, 6, 3, 4, 5, 2, 7, 8, 2, 6, 4, 5, 3, 7, 1, 1, 8, 3, 6, 5, 4, 7, 2, 9, 10, 2, 8, 4, 6, 5, 7, 3, 9, 1, 1, 10, 3, 8, 5, 6, 7, 4, 9, 2, 11
Offset: 1
Keywords
Examples
The start of the sequence as triangle array read by rows: 1; 2,1; 1,2,3; 4,2,3,1; 1,4,3,2,5; 6,2,4,3,5,1; 1,6,3,4,5,2,7; ... Row number k contains permutation numbers form 1 to k.
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
Crossrefs
Cf. A188568.
Programs
-
Python
t=int((math.sqrt(8*n-7) - 1)/ 2) i=n-t*(t+1)//2 j=(t*t+3*t+4)//2-n if i>=j: result=-max(i,j)*((-1)**i-1)/2+min(i,j)*((-1)**i+1)/2 else: result= max(i,j)*((-1)**j+1)/2-min(i,j)*((-1)**j-1)/2
Formula
a(n) = -max(i,j)*((-1)^i-1)/2+min(i,j)*((-1)^i+1)/2, if i>=j
a(n) = max(i,j)*((-1)^j+1)/2-min(i,j)*((-1)^j-1)/2, if i
where t = floor((-1+sqrt(8*n-7))/2), i = n-t*(t+1)/2, j = (t*t+3*t+4)/2-n.
A194982 Inverse permutation to A194981; every positive integer occurs exactly once.
1, 2, 3, 4, 6, 5, 7, 9, 10, 8, 11, 13, 15, 14, 12, 16, 18, 20, 21, 19, 17, 22, 24, 26, 27, 28, 25, 23, 29, 31, 33, 34, 36, 35, 32, 30, 37, 39, 41, 42, 44, 45, 43, 40, 38, 46, 48, 50, 51, 53, 55, 54, 52, 49, 47, 56, 58, 60, 61, 63, 65, 66, 64, 62, 59, 57, 67, 69, 71
Offset: 1
Keywords
Programs
-
Mathematica
(* See A194981. *)
A194280 Inverse permutation to A081344.
1, 2, 5, 3, 6, 9, 13, 8, 4, 7, 12, 18, 25, 19, 14, 10, 15, 20, 26, 33, 41, 32, 24, 17, 11, 16, 23, 31, 40, 50, 61, 51, 42, 34, 27, 21, 28, 35, 43, 52, 62, 73, 85, 72, 60, 49, 39, 30, 22, 29, 38, 48, 59, 71, 84, 98, 113
Offset: 1
Keywords
Examples
From _Boris Putievskiy_, Mar 14 2013: (Start) The start of the sequence as table: 1....2...6...7..15..16..28... 3....5...9..12..20..23..35... 4....8..13..18..26..31..43... 10..14..19..25..33..40..52... 11..17..24..32..41..50..62... 21..27..34..42..51..61..73... 22..30..39..49..60..72..85... ... The start of the sequence as triangular array read by rows: 1; 2,5,3; 6,9,13,8,4; 7,12,18,25,19,14,10; 15,20,26,33,41,32,24,17,11; 16,23,31,40,50,61,51,42,34,27,21; 28,35,43,52,62,73,85,72,60,49,39,30,22; ... Row number r contains 2*r-1 numbers. (End)
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Python
t=int(math.sqrt(n-1))+1 i=(t % 2)*min(t,n-(t-1)**2) + ((t+1) % 2)*min(t,t**2-n+1) j=(t % 2)*min(t,t**2-n+1) + ((t+1) % 2)*min(t,n-(t-1)**2) m=(i+j-1)*(i+j-2)/2+j
Formula
a(n) = (i+j-1)*(i+j-2)/2+j, where
i = mod(t;2)*min{t; n - (t - 1)^2} + mod(t + 1; 2)*min{t; t^2 - n + 1}
j = mod(t;2)*min{t; t^2 - n + 1} + mod(t + 1; 2)*min{t; n - (t - 1)^2},
t = int(math.sqrt(n-1))+1.
A185180 Enumeration table T(n,k) by antidiagonals. The order of the list is symmetrical movement from center to edges diagonal.
1, 2, 3, 5, 4, 6, 9, 7, 8, 10, 14, 12, 11, 13, 15, 20, 18, 16, 17, 19, 21, 27, 25, 23, 22, 24, 26, 28, 35, 33, 31, 29, 30, 32, 34, 36, 44, 42, 40, 38, 37, 39, 41, 43, 45, 54, 52, 50, 48, 46, 47, 49, 51, 53, 55, 65, 63, 61, 59, 57, 56, 58, 60, 62, 64, 66, 77, 75
Offset: 1
Comments
The natural numbers are grouped in chunks of 1, 2, 3, 4,... as (1), (2,3), (4,5,6), (7,8,9,10), etc and each group fills a diagonal in the table. The smallest number in a group is in A000124, the largest in A000217. Numbers in a group are placed on free spots as close as possible to the middle of the diagonal, given preference to the smaller row numbers in the table if there is a draw.
The resulting array is apparently a transposed version of A064789 (if this was also written as an array).
The order of the list table T(n,k):
if n is odd:
T (floor(n+1)/2,floor(n+1)/2), T(floor(n+1)/2-1,floor(n+1)/2+1), T(floor(n+1)/2+1,floor(n+1)/2-1),...T(1,n), T(n,1)
if n is even:
T(floor(n+1)/2-1,floor(n+1)/2+1), T(floor(n+1)/2+1,floor(n+1)/2-1),...T(1,n), T(n,1).
Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Examples
The start of the sequence as table: 1....2....5....9...14...20...27 ... 3....4....7...12...18...25...33 ... 6....8...11...16...23...31...40 ... 10..13...17...22...29...38...48 ... 15..19...24...30...37...46...57 ... 21..26...32...39...47...56...67 ... 28..34...41...49...58...68...79 ... ... The start of the sequence as triangle array read by rows: 1; 2, 3; 5, 4, 6; 9, 7, 8, 10; 14, 12, 11, 13, 15; 20, 18, 16, 17, 19, 21; 27, 25, 23, 22, 24, 26, 28; . . . Row number k (k > 1) of the triangle contains a permutation of the set of k numbers from (k^2-k+2)/2, (k^2-k+2)/2 + 1 ,...up to (k^2+k-2)/2 + 1, namely (k^2+k-2)/2, (k^2+k-2)/2 -2,...,(k^2-k+2)/2, (k^2-k+2)/2 + 2,..., (k^2+k-2)/2-1, (k^2+k-2)/2+1.
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
- Eric W. Weisstein's World of Mathematics, Pairing functions
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Mathematica
a[n_] := Module[{i, j, t}, i = n - t(t+1)/2; j = (t^2 + 3t + 4)/2 - n; t = Floor[(-1 + Sqrt[8n - 7])/2]; If[j <= i, (i(i+1) + (j-1)(j + 2i - 4))/2, (i(i+1) + (j-1)(j + 2i - 4))/2 + 2(j-i) - 1]]; Array[a, 68] (* Jean-François Alcover, Nov 21 2018, from Python *)
-
Python
t=int((math.sqrt(8*n-7) - 1)/ 2) i=n-t*(t+1)/2 j=(t*t+3*t+4)/2-n if j<=i: m=(i*(i+1) + (j-1)*(j+2*i-4))/2 else: m=(i*(i+1) + (j-1)*(j+2*i-4))/2 +2*(j-i)-1
Formula
a(n) = (i*(i+1) + (j-1)*(j+2*i-4))/2, if j<=i, a(n)=(i*(i+1) + (j-1)*(j+2*i-4))/2 +2*(j-i)-1, if j>i, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor[(-1+sqrt(8*n-7))/2].
A064790 Inverse permutation to A060734.
1, 3, 5, 2, 6, 9, 13, 8, 4, 10, 14, 19, 25, 18, 12, 7, 15, 20, 26, 33, 41, 32, 24, 17, 11, 21, 27, 34, 42, 51, 61, 50, 40, 31, 23, 16, 28, 35, 43, 52, 62, 73, 85, 72, 60, 49, 39, 30, 22, 36, 44, 53, 63, 74, 86, 99, 113, 98, 84, 71, 59, 48, 38, 29, 45, 54, 64, 75, 87, 100, 114
Offset: 1
Comments
From Boris Putievskiy, Mar 14 2013: (Start)
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Examples
From _Boris Putievskiy_, Mar 14 2013: (Start) The start of the sequence as table: 1....2...6...7..15..16..28... 3....5...9..12..20..23..35... 4....8..13..18..26..31..43... 10..14..19..25..33..40..52... 11..17..24..32..41..50..62... 21..27..34..42..51..61..73... 22..30..39..49..60..72..85... ... The start of the sequence as triangular array read by rows: 1; 3,5,2; 6,9,13,8,4; 10,14,19,25,18,12,7; 15,20,26,33,41,32,24,17,11; 21,27,34,42,51,61,50,40,31,23,16; 28,35,43,52,62,73,85,72,60,49,39,30,22; ... Row number r contains 2*r-1 numbers. (End)
Links
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
- Eric Weisstein's MathWorld, Pairing Function
- Index entries for sequences that are permutations of the natural numbers
Formula
a(n) = (i+j-1)*(i+j-2)/2+i, where i=min(t; t^2-n+1), j=min(t; n-(t-1)^2), t=floor(sqrt(n-1))+1. - Boris Putievskiy, Dec 24 2012
A375797 Table T(n, k) read by upward antidiagonals. The sequences in each column k is a triangle read by rows (blocks), where each row is a permutation of the numbers of its constituents. Row number n in column k has length n*k = A003991(n,k); see Comments.
1, 2, 1, 3, 2, 3, 6, 3, 2, 1, 5, 5, 1, 3, 5, 4, 4, 4, 2, 2, 1, 7, 6, 8, 4, 3, 5, 7, 9, 7, 6, 5, 4, 3, 2, 1, 8, 11, 7, 11, 1, 4, 5, 7, 9, 10, 9, 5, 7, 6, 2, 4, 3, 2, 1, 15, 10, 9, 9, 14, 6, 3, 5, 7, 9, 11, 12, 8, 18, 8, 8, 7, 6, 4, 4, 3, 2, 1, 13, 12, 11, 10, 12, 17, 1, 6, 5, 7, 9, 11, 13, 14, 13, 16, 6, 10, 9, 8, 2, 6, 5, 4, 3, 2, 1
Offset: 1
Comments
A208233 presents an algorithm for generating permutations, where each generated permutation is self-inverse.
The sequence in each column k possesses two properties: it is both a self-inverse permutation and an intra-block permutation of natural numbers.
Examples
Table begins: k= 1 2 3 4 5 6 ----------------------------------- n= 1: 1, 1, 3, 1, 5, 1, ... n= 2: 2, 2, 2, 3, 2, 5, ... n= 3: 3, 3, 1, 2, 3, 3, ... n= 4: 6, 5, 4, 4, 4, 4, ... n= 5: 5, 4, 8, 5, 1, 2, ... n= 6: 4, 6, 6, 11, 6, 6, ... n= 7: 7, 7, 7, 7, 14, 7, ... n= 8: 9, 11, 5, 9, 8, 17, ... n= 9: 8, 9, 9, 8, 12, 9, ... n= 10: 10, 10, 18, 10, 10, 15, ... n= 11: 15, 8, 11, 6, 11, 11, ... n= 12: 12, 12, 16, 12, 9, 13, ... n= 13: 13, 13, 13, 13, 13, 12, ... n= 14: 14, 19, 14, 23, 7, 14, ... n= 15: 11, 15, 15, 15, 15, 10, ... n= 16: 16, 17, 12, 21, 30, 16, ... n= 17: 20, 16, 17, 17, 17, 8, ... n= 18: 18, 18, 10, 19, 28, 18, ... ... . In column 3, the first 3 blocks have lengths 3,6 and 9. In column 6, the first 2 blocks have lengths 6 and 12. Each block is a permutation of the numbers of its constituents. The first 6 antidiagonals are: 1; 2,1; 3,2,3; 6,3,2,1; 5,5,1,3,5; 4,4,4,2,2,1;
Links
- Boris Putievskiy, Table of n, a(n) for n = 1..9870
- Boris Putievskiy, Integer Sequences: Irregular Arrays and Intra-Block Permutations, arXiv:2310.18466 [math.CO], 2023.
- Index entries for sequences that are permutations of the natural numbers.
Crossrefs
Programs
-
Mathematica
T[n_,k_]:=Module[{L,R,P,result},L=Ceiling[(Sqrt[8*n*k+k^2]-k)/(2*k)]; R=n-k*(L-1)*L/2; P=(((-1)^Max[R,k*L+1-R]+1)*R-((-1)^Max[R,k*L+1-R]-1)*(k*L+1-R))/2; result=P+k*(L-1)*L/2] Nmax=18; Table[T[n,k],{n,1,Nmax},{k,1,Nmax}]
Formula
T(n,k) = P(n,k) + k*(L(n,k)-1)*L(n,k)/2 = P(n,k) + A062707(L(n-1),k), where L(n,k) = ceiling((sqrt(8*n*k+k^2)-k)/(2*k)), R(n,k) = n-k*(L(n,k)-1)*L(n,k)/2, P(n,k) = (((-1)^max(R(n,k),k*L(n,k)+1-R(n,k))+1)*R(n,k)-((-1)^max(R(n,k),k*L(n,k)+1-R(n,k))-1)*(k*L(n,k)+1-R(n,k)))/2.
Comments