A214871 Natural numbers placed in table T(n,k) layer by layer. The order of placement - T(n,n), T(1,n), T(n,1), T(2,n), T(n,2),...T(n-1,n), T(n,n-1). Table T(n,k) read by antidiagonals.
1, 3, 4, 6, 2, 7, 11, 8, 9, 12, 18, 13, 5, 14, 19, 27, 20, 15, 16, 21, 28, 38, 29, 22, 10, 23, 30, 39, 51, 40, 31, 24, 25, 32, 41, 52, 66, 53, 42, 33, 17, 34, 43, 54, 67, 83, 68, 55, 44, 35, 36, 45, 56, 69, 84, 102, 85, 70, 57, 46, 26, 47, 58, 71, 86, 103, 123
Offset: 1
Examples
The start of the sequence as table: 1....3...6..11..18..27... 4....2...8..13..20..29... 7....9...5..15..22..31... 12..14..16..10..24..33... 19..21..23..25..17..35... 28..30..32..34..36..26... . . . The start of the sequence as triangle array read by rows: 1; 3,4; 6,2,7; 11,8,9,12; 18,13,5,14,19; 27,20,15,16,21,28; . . .
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
- Eric Weisstein's World of Mathematics, Pairing functions
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
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=(i-1)**2+1 if i > j: result=(i-1)**2+2*j+1 if i < j: result=(j-1)**2+2*i
Formula
As table
T(n,k) = (n-1)^2+1, if n=k;
T(n,k) = (n-1)^2+2*k+1, if n>k;
T(n,k) = (k-1)^2+2*n, if n
As linear sequence
a(n) = (i-1)^2+1, if i=j;
a(n) = (i-1)^2+2*j+1, if i>j;
a(n) = (j-1)^2+2*i, if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).
A216252 A213196 as table read layer by layer clockwise.
1, 4, 5, 2, 3, 7, 10, 8, 6, 11, 9, 17, 20, 23, 14, 12, 13, 16, 26, 38, 43, 39, 21, 24, 15, 22, 25, 30, 42, 58, 63, 48, 35, 31, 27, 18, 19, 29, 34, 57, 53, 69, 76, 70, 64, 49, 36, 32, 28, 37, 33, 47, 52, 81, 75, 95, 102, 109, 88, 82, 54, 59, 44, 40, 41, 46, 62
Offset: 1
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.
Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1).
The order of the list:
T(1,1)=1;
T(1,2), T(2,2), T(2,1);
. . .
T(1,n), T(2,n), ... T(n-1,n), T(n,n), T(n,n-1), ... T(n,1);
. . .
Examples
The start of the sequence as table: 1....4...3..11..13... 2....5...7...9..16... 6....8..10..17..26... 12..14..23..20..38... 15..24..21..39..43... . . . The start of the sequence as triangular array read by rows: 1; 4,5,2; 3,7,10,8,6; 11,9,17,20,23,14,12; 13,16,26,38,43,39,21,24,15; . . . Row number r contains 2*r-1 numbers.
Links
- Boris Putievskiy, Rows n = 1..140 of triangle, flattened
- Boris Putievskiy, Transformations [of] Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO], 2012.
- Eric Weisstein's World of Mathematics, MathWorld: Pairing functions
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Python
t=int((math.sqrt(n-1)))+1 i=min(t,n-(t-1)**2) j=min(t,t**2-n+1) m1=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4 m2=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4 m=(m1+m2-1)*(m1+m2-2)/2+m1
Formula
a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where m1=(3*i+j-1-(-1)^i+(i+j-2)*(-1)^(i+j))/4, m2=((1+(-1)^i)*((1+(-1)^j)*2*int((j+2)/4)-(-1+(-1)^j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)^i)*((1+(-1)^j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)^j)*(1+2*int(j/4))))/4, i=min(t; n-(t-1)^2), j=min(t; t^2-n+1), t=floor(sqrt(n-1))+1.
A363460 a(n) is the permanent of the n X n matrix formed by placing 1..n^2 in L-shaped gnomons in alternating directions.
1, 1, 11, 556, 74964, 21700112, 11500685084, 10057140949968, 13496937368200000, 26331147893897760544, 71606290155732170272320, 262516365211410942628577408, 1262517559940020030446967822592, 7786463232979127181938238723356160, 60414239829783205320232261233394491136
Offset: 0
Keywords
Comments
Examples
a(5) = 21700112 is the permanent of the 5 X 5 matrix | 1----2 9---10 25 | | | | | | | | 4----3 8 11 24 | | | | | | | | 5----6----7 12 23 | | | | | | 16---15---14---13 22 | | | | | | 17---18---19---20---21 |
Crossrefs
Programs
-
Mathematica
a={1}; For[n=1, n<=14, n++,k=i=j=1; M[i,j]=k++; For[h=1, h
Comments