|
|
A295290
|
|
a(n) is the smallest triangular number t such that t - n is a square, or -1 if no such triangular number exists.
|
|
1
|
|
|
0, 1, 3, 3, -1, 6, 6, -1, -1, 10, 10, 15, 21, -1, 15, 15, -1, 21, -1, 28, 21, 21, -1, -1, 28, -1, -1, 28, 28, 45, 55, -1, 36, -1, -1, 36, 36, -1, -1, 55, -1, 45, 78, -1, 45, 45, 55, -1, -1, -1, 66, 55, -1, 78, 55, 55, 105, 66, -1, -1, -1, -1, 66, -1, -1, 66
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Smallest triangular number (A000217) that exceeds a square by exactly n, or -1 if there is no such triangular number.
|
|
LINKS
|
|
|
FORMULA
|
a(t) = t for every triangular number t.
a(t-1) = t for every positive triangular number t.
|
|
EXAMPLE
|
a(0) = 0 because 0 is the smallest number that is both triangular and square.
a(12) = 21 because 21 - 12 = 9 = 3^2 and there is no triangular number t < 21 such that t - 12 is a square.
a(4) = -1 because there exists no triangular number t such that t - 4 is a square.
|
|
MAPLE
|
f:= proc(n) local s, t, R, v, R0;
R:= [isolve(s^2 - 2*t^2 = 8*n+1)];
if R = [] then return -1 fi;
v:= indets(R, name) minus {s, t};
R0:= remove(hastype, eval(R, v[1]=0), negative);
s:= subs(R0[1], s);
(s^2-1)/8;
end proc:
|
|
MATHEMATICA
|
a[n_] := Module[{s, t, k}, If[Solve[s^2 - 2t^2 == 8n+1, {s, t}, Integers] == {}, Return[-1]]; For[k = 0, True, k++, t = k(k+1)/2; If[IntegerQ[ Sqrt[t-n]], Return[t]]]];
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|