login
First inverse function (numbers of rows) for pairing function A060734
2

%I #23 Apr 28 2016 12:42:24

%S 1,2,2,1,3,3,3,2,1,4,4,4,4,3,2,1,5,5,5,5,5,4,3,2,1,6,6,6,6,6,6,5,4,3,

%T 2,1,7,7,7,7,7,7,7,6,5,4,3,2,1,8,8,8,8,8,8,8,8,7,6,5,4,3,2,1,9,9,9,9,

%U 9,9,9,9,9

%N First inverse function (numbers of rows) for pairing function A060734

%C The sequence is the second inverse function (numbers of columns) for pairing function A060736.

%H Boris Putievskiy, <a href="/A194195/b194195.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 a(n) = min{t; t^2 - n + 1}, where t=floor(sqrt(n-1))+1.

%e The start of the sequence as triangle array read by rows:

%e 1;

%e 2,2,1;

%e 3,3,3,2,1;

%e 4,4,4,4,3,2,1;

%e . . .

%e Row number k contains 2k-1 numbers k,k,...k,k-1,k-2,...1 (k times repetition "k").

%t f[n_]:=Module[{t=Floor[Sqrt[n-1]]+1},Min[t,t^2-n+1]]; Array[f,80] (* _Harvey P. Dale_, Dec 31 2012 *)

%o (Python)

%o t=int(math.sqrt(n-1)) +1

%o i=min(t,t**2-n+1)

%Y Cf. A060734, A060736, A220603, A220604

%K nonn,tabf

%O 1,2

%A _Boris Putievskiy_, Dec 21 2012