cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A194195 First inverse function (numbers of rows) for pairing function A060734.

Original entry on oeis.org

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, 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, 9, 9, 9, 9, 9
Offset: 1

Views

Author

Boris Putievskiy, Dec 21 2012

Keywords

Comments

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

Examples

			The start of the sequence as triangle array read by rows:
1;
2,2,1;
3,3,3,2,1;
4,4,4,4,3,2,1;
. . .
Row number k contains 2k-1 numbers k,k,...k,k-1,k-2,...1 (k times repetition "k").
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{t=Floor[Sqrt[n-1]]+1},Min[t,t^2-n+1]]; Array[f,80] (* Harvey P. Dale, Dec 31 2012 *)
  • Python
    t=int(math.sqrt(n-1)) +1
    i=min(t,t**2-n+1)

Formula

a(n) = min{t; t^2 - n + 1}, where t=floor(sqrt(n-1))+1.