%I #43 Apr 21 2020 11:03:03
%S 1,2,1,2,3,2,1,2,3,4,3,2,1,2,3,4,5,4,3,2,1,2,3,4,5,6,5,4,3,2,1,2,3,4,
%T 5,6,7,6,5,4,3,2,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,
%U 5,4,3,2,1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,10,11,10,9
%N Concatenation of sequences (1,2,...,n-1,n,n-1,...,2) for n >= 2.
%C Also concatenation of sequences n,n-1,...,2,1,2,...,n-1,n.
%C Table T(n,k) n, k > 0, T(n,k) = n-k+1, if n >= k, T(n,k) = k-n+1, 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). General case A209301. Let m be a 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, for m=3 the result is A209301. - _Boris Putievskiy_, Jan 24 2013
%D F. Smarandache, "Numerical Sequences", University of Craiova, 1975; [ See Arizona State University, Special Collection, Tempe, AZ, USA ].
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [Of] Integer Sequences And Pairing Functions</a>, arXiv preprint arXiv:1212.2732 [math.CO], 2012.
%H F. Smarandache, <a href="http://www.gallup.unm.edu/~smarandache/CP2.pdf">Collected Papers, Vol. II</a>
%H F. Smarandache, <a href="http://www.gallup.unm.edu/~smarandache/Sequences-book.pdf">Sequences of Numbers Involved in Unsolved Problems</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SmarandacheSequences.html">Smarandache Sequences</a>
%F a(n) = floor(sqrt(n) + 1/2) + 1 - abs(n - 1 - (floor(sqrt(n) + 1/2))^2). - _Benoit Cloitre_, Feb 08 2003
%F From _Boris Putievskiy_, Jan 24 2013: (Start)
%F For the general case, a(n) = m*v + (2*v-1)*(t*t-n) + t, where t = floor((sqrt(n) - 1/2) + 1 and v = floor((n-1)/t) - t + 1.
%F For m=2, a(n) = 2*v + (2*v-1)*(t*t-n)+t, where t = floor((sqrt(n) - 1/2) + 1 and v = floor((n-1)/t) - t + 1. (End)
%e From _Boris Putievskiy_, Jan 24 2013: (Start)
%e The start of the sequence as table:
%e 1, 2, 3, 4, 5, 6, 7, ...
%e 2, 1, 2, 3, 4, 5, 6, ...
%e 3, 2, 1, 2, 3, 4, 5, ...
%e 4, 3, 2, 1, 2, 3, 4, ...
%e 5, 4, 3, 2, 1, 2, 3, ...
%e 6, 5, 4, 3, 2, 1, 2, ...
%e 7, 6, 5, 4, 3, 2, 1, ...
%e ...
%e The start of the sequence as triangle array read by rows:
%e 1;
%e 2, 1, 2;
%e 3, 2, 1, 2, 3;
%e 4, 3, 2, 1, 2, 3, 4;
%e 5, 4, 3, 2, 1, 2, 3, 4, 5;
%e 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6;
%e 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7;
%e ...
%e Row number r contains 2*r - 1 numbers: r, r-1, ..., 1, 2, ..., r. (End)
%p A004738 := proc(n)
%p local tri ;
%p tri := floor(sqrt(n)+1/2) ;
%p tri+1-abs(n-1-tri^2) ;
%p end proc:
%p seq(A004738(n),n=1..30) ; #_R. J. Mathar_, Feb 14 2019
%t row[n_] := Range[n, 1, -1] ~Join~ Range[2, n];
%t Array[row, 10] // Flatten (* _Jean-François Alcover_, Apr 19 2020 *)
%o (PARI) a(n)= floor(sqrt(n)+1/2)+1-abs(n-1-(floor(sqrt(n)+1/2)-1/2)^2)
%Y Cf. A004737, A004739, A187760, A079813, A209301.
%K nonn,easy
%O 1,2
%A R. Muller
%E More terms from _Patrick De Geest_, Jun 15 1998