OFFSET
0,4
COMMENTS
LINKS
David A. Corneth, Table of n, a(n) for n = 0..10200
FORMULA
From David A. Corneth, Jan 11 2019: (Start)
a(n^2 + j) = n + j for 0 <= j <= n-1.
a(n^2 + j) = j, n <= j <= 2*n (End)
EXAMPLE
The sorted pairs (x,y) and their sums x+y are:
(0,0) => 0
(0,1) => 1
(1,0) => 1
(1,1) => 2
(0,2) => 2
(1,2) => 3
(2,0) => 2
(2,1) => 3
(2,2) => 4
(0,3) => 3
etc.
PROG
(PARI) first(n) = {n = (sqrtint(n) + 1) ^ 2; res = vector(n); for(i = 0, sqrtint(n) - 1, res[i^2 + 1] = i; for(j = 1, i - 1, res[i ^ 2 + j + 1] = i + j; ); for(j = i, 2 * i, res[i ^ 2 + j + 1] = j; ) ); res } \\ David A. Corneth, Jan 11 2019
CROSSREFS
KEYWORD
AUTHOR
Charlie Neder, Dec 27 2018
EXTENSIONS
Edited by N. J. A. Sloane, Dec 28 2018
STATUS
approved