OFFSET
0,5
COMMENTS
The two solutions of the Diophantine equation x^2 + n*x - 2*t = 0 are x_1 = ( - n + sqrt(n^2 + 8*t)) / 2 and x_2 = ( - n - sqrt(n^2 + 8*t)) / 2.
a(n) <= n^4/32 - n^2/8, with equality if n is in A014574. - Robert Israel, Sep 21 2025
LINKS
Michel Marcus, Table of n, a(n) for n = 0..10000
Ctibor O. Zizka, Plot of n vs. a(n)
FORMULA
EXAMPLE
For n = 4, the least triangular number t >= 1 such that (16 + 8*t) is a square is t = 6, thus a(4) = 6.
MAPLE
f:= proc(n) local s, S, q;
q:= n^2-1;
S:= select(t -> t - q/t mod 4 = 2, numtheory:-divisors(q));
S:= select (`>=`, map(s -> (s-q/s)/4-1/2, S), 1);
if S = {} then return -1 fi;
s:= min(S);
s*(s+1)/2
end proc:
f(1):= 1:
map(f, [$0..100]); # Robert Israel, Sep 21 2025
MATHEMATICA
a[n_] := Module[{k = 1, t = 1}, While[! IntegerQ[Sqrt[n^2 + 8*t]], k++; t += k]; t]; a[0] = a[2] = a[3] = -1; Array[a, 100, 0] (* Amiram Eldar, Sep 21 2025 *)
PROG
(PARI) a(n) = if ((n==0) || (n==2) || (n==3), -1, my(k=1); while (!issquare(n^2+4*k*(k+1)), k++); t=k*(k+1)/2); \\ Michel Marcus, Sep 21 2025
CROSSREFS
KEYWORD
sign,look
AUTHOR
Ctibor O. Zizka, Sep 20 2025
STATUS
approved
