The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A220603 First inverse function (numbers of rows) for pairing function A081344. 6

%I #36 Feb 06 2023 12:46:06

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

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

%U 5,6,7,8,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,9,8,7,6,5,4,3,2,1

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

%H Boris Putievskiy, <a href="/A220603/b220603.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 As a linear array, the sequence is a(n) = mod(t;2)*min{t; n - (t - 1)^2} + mod(t + 1; 2)*min{t; t^2 - n + 1}, where t=floor[sqrt(n-1)]+1.

%e The start of the sequence as triangle array T(n,k) read by rows, row number k contains 2k-1 numbers:

%e 1;

%e 2,2,1;

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

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

%e ...

%e If k is odd the row is 1,2,...,k,k...k (k times repetition "k" at the end of row).

%e If k is even the row is k,k,...k,k-1,k-2,...1 (k times repetition "k" at the start of row).

%t row[n_] := If[OddQ[n], Range[n-1]~Join~Table[n, {n}], Table[n, {n}]~Join~ Range[n-1, 1, -1]];

%t row /@ Range[10] // Flatten (* _Jean-François Alcover_, Nov 19 2019 *)

%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)

%Y Cf. A081344.

%K nonn,tabf

%O 1,2

%A _Boris Putievskiy_, Dec 16 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 1 04:03 EDT 2024. Contains 373010 sequences. (Running on oeis4.)