login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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:
map(f, [$0..100]); # Robert Israel, Nov 22 2017
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]]]];
a /@ Range[0, 100] (* Jean-François Alcover, Oct 16 2020 *)
CROSSREFS
Cf. A000217 (triangular numbers), A000290 (squares), A001100 (square triangular numbers).
Sequence in context: A208539 A174128 A131070 * A165202 A010468 A082009
KEYWORD
sign
AUTHOR
Jon E. Schoenfield, Nov 19 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 02:04 EDT 2024. Contains 371782 sequences. (Running on oeis4.)