A213921 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places clockwise. Table T(n,k) read by antidiagonals.
1, 2, 3, 5, 4, 7, 10, 8, 9, 13, 17, 14, 6, 16, 21, 26, 22, 11, 12, 25, 31, 37, 32, 18, 15, 20, 36, 43, 50, 44, 27, 23, 24, 30, 49, 57, 65, 58, 38, 33, 19, 35, 42, 64, 73, 82, 74, 51, 45, 28, 29, 48, 56, 81, 91, 101, 92, 66, 59, 39, 34, 41, 63, 72, 100, 111
Offset: 1
Examples
The start of the sequence as table: 1 2 5 10 17 26 ... 3 4 8 14 22 32 ... 7 9 6 11 18 27 ... 13 16 12 15 23 33 ... 21 25 20 24 19 28 ... 31 36 30 35 29 34 ... ... The start of the sequence as triangle array read by rows: 1; 2, 3; 5, 4, 7; 10, 8, 9, 13; 17, 14, 6, 16, 21; 26, 22, 11, 12, 25, 31; ...
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 W. Weisstein, MathWorld: 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*i-(j%2)*i+2-int((j+2)/2) else: result=j*j-((i%2)+1)*j + int((i+3)/2)
Formula
As a table:
T(n,k) = n*n - (k mod 2)*n + 2 - floor((k+2)/2), if n>k;
T(n,k) = k*k - ((n mod 2)+1)*k + floor((n+3)/2), if n<=k.
As a linear sequence:
a(n) = i*i - (j mod 2)*i + 2 - floor((j+2)/2), if i>j;
a(n) = j*j - ((i mod 2)+1)*j + floor((i+3)/2), 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).
Comments