%I #21 Dec 18 2022 20:00:46
%S 1,3,1,2,4,3,1,2,3,5,4,3,1,2,3,4,6,5,4,3,1,2,3,4,5,7,6,5,4,3,1,2,3,4,
%T 5,6,8,7,6,5,4,3,1,2,3,4,5,6,7,9,8,7,6,5,4,3,1,2,3,4,5,6,7,8,10,9,8,7,
%U 6,5,4,3,1,2,3,4,5,6,7,8,9,11,10,9,8,7
%N Table T(n,k) n, k > 0, T(n,k)=n-k+1, if n>=k, T(n,k)=k-n+2, if n < k. Table read by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1).
%C In general, let m be natural number. The first column of the table T(n,1) is the sequence of the natural numbers A000027. In all columns with number k (k > 1) the segment with the length of (k-1): {m+k-2, m+k-3, ..., m} shifts the sequence A000027. For m=1 the result is A004739, for m=2 the result is A004738. This sequence is result for m=3.
%H Boris Putievskiy, <a href="/A209301/b209301.txt">Rows n = 1..140 of triangle, flattened</a>
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations Integer Sequences And Pairing Functions</a>, arXiv:1212.2732 [math.CO], 2012.
%F For the general case
%F a(n ) = m*v+(2*v-1)*(t*t-n)+t,
%F where
%F t = floor((sqrt(n)-1/2)+1,
%F v = floor((n-1)/t)-t+1.
%F For m=3
%F a(n ) = 3*v+(2*v-1)*(t*t-n)+t,
%F where
%F t = floor((sqrt(n)-1/2)+1,
%F v = floor((n-1)/t)-t+1.
%e The start of the sequence as table for the general case:
%e 1....m..m+1..m+2..m+3..m+4..m+5...
%e 2....1....m..m+1..m+2..m+3..m+4...
%e 3....2....1....m..m+1..m+2..m+3...
%e 4....3....2....1....m..m+1..m+2...
%e 5....4....3....2....1....m..m+1...
%e 6....5....4....3....2....1....m...
%e 7....6....5....4....3....2....1...
%e ...
%e The start of the sequence as triangle array read by rows for the general case:
%e 1;
%e m,1,2;
%e m+1,m,1,2,3;
%e m+2,m+1,m,1,2,3,4;
%e m+3,m+2,m+1,m,1,2,3,4,5;
%e m+4, m+3,m+2,m+1,m,1,2,3,4,5,6;
%e m+5, m+4, m+3,m+2,m+1,m,1,2,3,4,5,6,7;
%e ...
%e Row number r contains 2*r -1 numbers: m+r-2, m+r-1,...m,1,2,...r.
%e The start of the sequence as triangle array read by rows for m=3:
%e 1;
%e 3,1,2;
%e 4,3,1,2,3;
%e 5,4,3,1,2,3,4;
%e 6,5,4,3,1,2,3,4,5;
%e 7,6,5,4,3,1,2,3,4,5,6;
%e 8,7,6,5,4,3,1,2,3,4,5,6,7;
%e ...
%o (Python)
%o t=int((math.sqrt(n))-0.5)+1
%o v=int((n-1)/t)-t+1
%o result=k*v+(2*v-1)*(t**2-n)+t
%Y Cf. A187760, A004739, A004738.
%K nonn,tabl
%O 1,2
%A _Boris Putievskiy_, Jan 18 2013
|