%I #23 Sep 17 2022 05:22:53
%S 0,1,4,9,16,121,324,529,4096,11025,17956,139129,374544,609961,4726276,
%T 12723489,20720704,160554241,432224100,703893961,5454117904,
%U 14682895929,23911673956,185279454481,498786237504,812293020529,6294047334436,16944049179225,27594051024016
%N Squares that differ from a triangular number by 1.
%C Squares k such that 8*k-7 or 8*k+9 is a square. - _Robert Israel_, Mar 18 2018
%H Robert Israel, <a href="/A299921/b299921.txt">Table of n, a(n) for n = 1..1959</a>
%H <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,35,0,0,-35,0,0,1).
%F From _Robert Israel_, Mar 18 2018: (Start)
%F G.f.: x^2*(1+4*x+9*x^2-19*x^3-19*x^4+9*x^5+4*x^6+x^7)/(1-35*x^3+35*x^6-x^9).
%F a(n) = 35*a(n-3) - 35*a(n-6) + a(n-9). (End)
%p f:= gfun:-rectoproc({a(n+9) = 35*a(n+6) - 35*a(n+3) + a(n), seq(a(i)=[0, 1, 4, 9, 16, 121, 324, 529, 4096][i],i=1..9)}, a(n), remember):
%p map(f, [$1..50]); # _Robert Israel_, Mar 18 2018
%t LinearRecurrence[{0, 0, 35, 0, 0, -35, 0, 0, 1}, {0, 1, 4, 9, 16, 121, 324, 529, 4096}, 50] (* _Jean-François Alcover_, Sep 17 2022 *)
%o (PARI) isok(n) = issquare(n) && (ispolygonal(n+1, 3) || ispolygonal(n-1, 3)); \\ _Michel Marcus_, Mar 17 2018
%Y Cf. A001110, A164080, A182334, A229131.
%K nonn
%O 1,3
%A _N. J. A. Sloane_, Mar 17 2018
%E More terms from _Altug Alkan_, Mar 17 2018