OFFSET
1,1
COMMENTS
See A186219.
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = n + floor(sqrt((n^2+n)/2 + 1/4)).
a(n) = A061288(n) - n for all n in Z. - Michael Somos, Aug 19 2018
EXAMPLE
First, write
1..3...6..10..15...21..28..36..45... (triangular)
1....4...9......16...25....36....49.. (square)
Replace each number by its rank, where ties are settled by ranking the triangular number after the square:
a=(2,3,5,7,8,10,12,14,...)
b=(1,4,6,9,11,13,16,18,...).
MATHEMATICA
(* adjusted joint ranking; general formula *)
d=-1/4; u=1/2; v=1/2; w=0; x=1; y=0; z=0;
h[n_]:=-y+(4x(u*n^2+v*n+w-z-d)+y^2)^(1/2);
a[n_]:=n+Floor[h[n]/(2x)];
k[n_]:=-v+(4u(x*n^2+y*n+z-w+d)+v^2)^(1/2);
b[n_]:=n+Floor[k[n]/(2u)];
Table[a[n], {n, 1, 100}] (* A186221 *)
Table[b[n], {n, 1, 100}] (* A186222 *)
a[ n_] := n + Floor[ Sqrt[ n (n + 1)/2]]; (* Michael Somos, Aug 19 2018 *)
PROG
(PARI) vector(120, n, n + floor(sqrt((n^2+n)/2 + 1/4))) \\ G. C. Greubel, Aug 18 2018
{a(n) = n + sqrtint( n * (n+1) \ 2)}; /* Michael Somos, Aug 19 2018 */
(Magma) [n + Floor(Sqrt((n^2+n)/2 + 1/4)): n in [1..120]]; // G. C. Greubel, Aug 18 2018
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Clark Kimberling, Feb 15 2011
STATUS
approved