OFFSET
1,3
COMMENTS
Notice that x^2 = y*(y+n) is equivalent to (n+2*y+2*x)*(n+2*y-2*x) = n^2. We take the factorization of n^2 into two factors congruent mod 4 where one is as small as possible and the other is as large as possible. For n == 0 mod 4 the factors are 4 and n^2/4, for n == 2 mod 4 they are 2 and n^2/2, for n odd they are 1 and n^2. - Robert Israel, Jun 27 2014
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
FORMULA
Empirical g.f.: x^3*(x^9-2*x^6-3*x^5-6*x^4-4*x^3-6*x^2-2) / ((x-1)^3*(x+1)^3*(x^2+1)^3). - Colin Barker, Jun 26 2014
a(4*j) = j^2 - 1,
a(4*j+1) = 4*j^2+2*j,
a(4*j+2) = 2*j^2+2*j,
a(4*j+3) = 4*j^2+6*j+2. (see Comments) - Robert Israel, Jun 27 2014
EXAMPLE
a(15)=56 since the solutions (x,y) to x^2=y(y+15) are (4,1), (10,5), (18, 12) and (56, 49). The largest x is 56, from (x,y)=(56,49).
MATHEMATICA
Table[Max[x/.Solve[{x^2==y(y+n), x>0}, {x, y}, Integers]], {n, 1, 100}]/.x->0 (* Vaclav Kotesovec, Jun 26 2014 *)
PROG
(Python)
def A115880(n):
a, b = divmod(n, 4)
return (a**2-1, (c:=a<<1)*(c+1), c*(a+1), c*(c+3)+2)[b] # Chai Wah Wu, Aug 21 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Giovanni Resta, Feb 02 2006
STATUS
approved