login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A220603 First inverse function (numbers of rows) for pairing function A081344. 4
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, 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, 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 (list; table; graph; refs; listen; history; text; internal format)
OFFSET

1,2

LINKS

Boris Putievskiy, Rows n = 1..140 of triangle, flattened

Boris Putievskiy, Transformations Integer Sequences And Pairing Functions arXiv:1212.2732 [math.CO]

FORMULA

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.

EXAMPLE

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

1;

2,2,1;

1,2,3,3,3;

4,4,4,4,3,2,1;

. . .

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

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

MATHEMATICA

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

row /@ Range[10] // Flatten (* Jean-Fran├žois Alcover, Nov 19 2019 *)

PROG

(Python)

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

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

CROSSREFS

Cf. A081344.

Sequence in context: A242357 A120423 A113137 * A238404 A331910 A240168

Adjacent sequences:  A220600 A220601 A220602 * A220604 A220605 A220606

KEYWORD

nonn,tabl

AUTHOR

Boris Putievskiy, Dec 16 2012

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 6 13:04 EDT 2021. Contains 343585 sequences. (Running on oeis4.)