%I #22 Nov 29 2023 06:57:42
%S 1,2,1,2,3,1,2,4,3,1,2,4,5,3,1,2,4,6,5,3,1,2,4,6,7,5,3,1,2,4,6,8,7,5,
%T 3,1,2,4,6,8,9,7,5,3,1,2,4,6,8,10,9,7,5,3,1,2,4,6,8,10,11,9,7,5,3,1,2,
%U 4,6,8,10,12,11,9,7,5,3,1,2,4,6,8,10,12
%N Second inverse function (numbers of columns) for pairing function A209293.
%H Boris Putievskiy, <a href="/A210535/b210535.txt">Rows n = 1..140 of triangle, flattened</a>
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [of] Integer Sequences And Pairing Functions</a> arXiv:1212.2732 [math.CO], 2012.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a>
%F a(n) = 2*A200260(n)-A101688(n)*(4*A002260(n)-2*A003056(n)-3).
%F a(n) = 2*i-v*(4*i-2*t-3), where t = floor((-1+sqrt(8*n-7))/2), i = n-t*(t+1)/2, v = floor((2*n+1-t*(t+1))/(t+3)).
%e The start of the sequence as triangle array read by rows:
%e 1;
%e 2,1;
%e 2,3,1;
%e 2,4,3,1;
%e 2,4,5,3,1;
%e 2,4,6,5,3,1;
%e 2,4,6,7,5,3,1;
%e 2,4,6,8,7,5,3,1;
%e . . .
%e Row number r contains permutation numbers from 1 to r: 2,4,6,...2*floor(r/2),2*floor(r/2)-1,2*floor(r/2)-3,...3,1.
%o (Python)
%o t=int((math.sqrt(8*n-7)-1)/2)
%o i=n-t*(t+1)/2
%o v=int((2*n+1-t*(t+1))/(t+3))
%o result=2*i-v*(4*i-2*t-3)
%Y Cf. A209293, A200260, A101688, A003056, A220073.
%K nonn
%O 1,2
%A _Boris Putievskiy_, Jan 28 2013