login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A209293
Inverse permutation of A185180.
5
1, 2, 3, 5, 4, 6, 8, 9, 7, 10, 13, 12, 14, 11, 15, 18, 19, 17, 20, 16, 21, 25, 24, 26, 23, 27, 22, 28, 32, 33, 31, 34, 30, 35, 29, 36, 41, 40, 42, 39, 43, 38, 44, 37, 45, 50, 51, 49, 52, 48, 53, 47, 54, 46, 55, 61, 60, 62, 59, 63, 58, 64, 57, 65, 56, 66, 72, 73, 71, 74, 70, 75, 69, 76, 68, 77, 67
OFFSET
1,2
COMMENTS
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.
Enumeration table T(n,k) by diagonals. The order of the list
if n is odd - T(n-1,2),T(n-3,4),...,T(2,n-1),T(1,n),T(3,n-2),...T(n,1).
if n is even - T(n-1,2),T(n-3,4),...,T(3,n-2),T(1,n),T(2,n-1),...T(n,1).
Table T(n,k) contains:
Column number 1 A000217,
column number 2 A000124,
column number 3 A000096,
column number 4 A152948,
column number 5 A034856,
column number 6 A152950,
column number 7 A055998.
Row numder 1 A000982,
row number 2 A097063.
FORMULA
As table T(n,k) read by antidiagonals
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where
m1 = int((i+j)/2)+int(i/2)*(-1)^(i+t+1),
m2 = int((i+j+1)/2)+int(i/2)*(-1)^(i+t),
t = int((math.sqrt(8*n-7) - 1)/ 2),
i = n-t*(t+1)/2,
j = (t*t+3*t+4)/2-n.
EXAMPLE
The start of the sequence as table:
1....2...5...8..13..18...25...32...41...
3....4...9..12..19..24...33...40...51...
6....7..14..17..26..31...42...49...62...
10..11..20..23..34..39...52...59...74...
15..16..27..30..43..48...63...70...87...
21..22..35..38..53..58...75...82..101...
28..29..44..47..64..69...88...95..116...
36..37..54..57..76..81..102..109..132...
45..46..65..68..89..94..117..124..149...
. . .
The start of the sequence as triangle array read by rows:
1;
2,3;
5,4,6;
8,9,7,10;
13,12,14,11,15;
18,19,17,20,16,21;
25,24,26,23,27,22,28;
32,33,31,34,30,35,29,36;
41,40,42,39,43,38,44,37,45;
. . .
Row number r contains permutation from r numbers:
if r is odd ceiling(r^2/2), ceiling(r^2/2)+1, ceiling(r^2/2)-1, ceiling(r^2/2)+2, ceiling(r^2/2)-2,...r*(r+1)/2;
if r is even ceiling(r^2/2), ceiling(r^2/2)-1, ceiling(r^2/2)+1, ceiling(r^2/2)-2, ceiling(r^2/2)+2,...r*(r+1)/2;
MATHEMATICA
max = 10; row[n_] := Table[Ceiling[(n + k - 1)^2/2] + If[OddQ[k], 1, -1]*Floor[n/2], {k, 1, max}]; t = Table[row[n], {n, 1, max}]; Table[t[[n - k + 1, k]], {n, 1, max}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Jan 17 2013 *)
PROG
(Python)
t=int((math.sqrt(8*n-7) - 1)/ 2)
i=n-t*(t+1)/2
j=(t*t+3*t+4)/2-n
m1=int((i+j)/2)+int(i/2)*(-1)**(i+t+1)
m2=int((i+j+1)/2)+int(i/2)*(-1)**(i+t)
m=(m1+m2-1)*(m1+m2-2)/2+m1
KEYWORD
nonn,tabl
AUTHOR
Boris Putievskiy, Jan 16 2013
STATUS
approved