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”).
%I #30 Feb 15 2022 12:58:20
%S 1,2,5,3,6,9,13,8,4,7,12,18,25,19,14,10,15,20,26,33,41,32,24,17,11,16,
%T 23,31,40,50,61,51,42,34,27,21,28,35,43,52,62,73,85,72,60,49,39,30,22,
%U 29,38,48,59,71,84,98,113
%N Inverse permutation to A081344.
%C Permutation of the natural numbers.
%C 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.
%C 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). This sequence is A188568 as table read layer by layer clockwise.
%C The same table A188568 read by boustrophedon ("ox-plowing") method - layer clockwise, layer counterclockwise and so on - is A064790. - _Boris Putievskiy_, Mar 14 2013
%H Boris Putievskiy, <a href="/A194280/b194280.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.
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(n) = (i+j-1)*(i+j-2)/2+j, where
%F i = mod(t;2)*min{t; n - (t - 1)^2} + mod(t + 1; 2)*min{t; t^2 - n + 1}
%F j = mod(t;2)*min{t; t^2 - n + 1} + mod(t + 1; 2)*min{t; n - (t - 1)^2},
%F t = int(math.sqrt(n-1))+1.
%e From _Boris Putievskiy_, Mar 14 2013: (Start)
%e The start of the sequence as table:
%e 1....2...6...7..15..16..28...
%e 3....5...9..12..20..23..35...
%e 4....8..13..18..26..31..43...
%e 10..14..19..25..33..40..52...
%e 11..17..24..32..41..50..62...
%e 21..27..34..42..51..61..73...
%e 22..30..39..49..60..72..85...
%e ...
%e The start of the sequence as triangular array read by rows:
%e 1;
%e 2,5,3;
%e 6,9,13,8,4;
%e 7,12,18,25,19,14,10;
%e 15,20,26,33,41,32,24,17,11;
%e 16,23,31,40,50,61,51,42,34,27,21;
%e 28,35,43,52,62,73,85,72,60,49,39,30,22;
%e ...
%e Row number r contains 2*r-1 numbers. (End)
%o (Python)
%o t=int(math.sqrt(n-1))+1
%o i=(t % 2)*min(t,n-(t-1)**2) + ((t+1) % 2)*min(t,t**2-n+1)
%o j=(t % 2)*min(t,t**2-n+1) + ((t+1) % 2)*min(t,n-(t-1)**2)
%o m=(i+j-1)*(i+j-2)/2+j
%Y Cf. A081344, A064790, A188568.
%K nonn
%O 1,2
%A _Boris Putievskiy_, Dec 23 2012