login
A064788
Inverse permutation to A060736.
4
1, 2, 5, 3, 4, 8, 13, 9, 6, 7, 12, 18, 25, 19, 14, 10, 11, 17, 24, 32, 41, 33, 26, 20, 15, 16, 23, 31, 40, 50, 61, 51, 42, 34, 27, 21, 22, 30, 39, 49, 60, 72, 85, 73, 62, 52, 43, 35, 28, 29, 38, 48, 59, 71, 84, 98, 113, 99, 86, 74, 63, 53, 44, 36, 37, 47, 58, 70, 83, 97, 112
OFFSET
1,2
FORMULA
a(n) = (i+j-1)*(i+j-2)/2+j, where i=min(t; t^2-n+1), j=min(t; n-(t-1)^2), t=floor(sqrt(n-1))+1. - Boris Putievskiy, Dec 24 2012
PROG
(PARI) A064788(n)={my(t=sqrtint(n-1)+1); A000217(min(t, t^2-n+1)-2+n=min(t, n-(t-1)^2))+n} \\ recall: A000217(n)=(n+1)*n/2 \\ M. F. Hasler, Jan 13 2013
CROSSREFS
Sequence in context: A245815 A105108 A118460 * A099521 A331373 A120238
KEYWORD
easy,nonn
AUTHOR
N. J. A. Sloane, Oct 20 2001
EXTENSIONS
More terms from David Wasserman, Jan 15 2002
STATUS
approved