%I #34 Mar 15 2022 04:34:58
%S 0,16,20,68,76,156,168,280,296,440,460,636,660,868,896,1136,1168,1440,
%T 1476,1780,1820,2156,2200,2568,2616,3016,3068,3500,3556,4020,4080,
%U 4576,4640,5168,5236,5796,5868,6460,6536,7160,7240,7896,7980,8668,8756,9476,9568
%N Numbers k such that 18*k+1 is a square.
%C Equivalently, numbers of the form m*(18*m+2), where m = 0,-1,1,-2,2,-3,3,...
%C Also, integer values of 2*h*(h+1)/9.
%H Bruno Berselli, <a href="/A219395/b219395.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-2,-1,1).
%F G.f.: 4*x^2*(4 + x + 4*x^2)/((1 + x)^2*(1 - x)^3).
%F a(n) = a(-n+1) = (18*n*(n-1) + 7*(-1)^n*(2*n-1) - 1)/4 + 2.
%F Sum_{n>=2} 1/a(n) = 9/2 - cot(Pi/9)*Pi/2. - _Amiram Eldar_, Mar 15 2022
%p A219395:=proc(q)
%p local n;
%p for n from 1 to q do if type(sqrt(18*n+1), integer) then print(n);
%p fi; od; end:
%p A219395(1000); # _Paolo P. Lava_, Feb 19 2013
%t Select[Range[0, 10000], IntegerQ[Sqrt[18 # + 1]] &]
%t CoefficientList[Series[4 x (4 + x + 4 x^2)/((1 + x)^2 (1 - x)^3), {x, 0, 50}], x] (* _Vincenzo Librandi_, Aug 18 2013 *)
%t LinearRecurrence[{1,2,-2,-1,1},{0,16,20,68,76},50] (* _Harvey P. Dale_, Dec 24 2014 *)
%o (Magma) [n: n in [0..10000] | IsSquare(18*n+1)];
%o (Magma) I:=[0,16,20,68,76]; [n le 5 select I[n] else Self(n-1)+2*Self(n-2)-2*Self(n-3)-Self(n-4)+Self(n-5): n in [1..50]]; // _Vincenzo Librandi_, Aug 18 2013
%Y Cf. similar sequences listed in A219257.
%K nonn,easy
%O 1,2
%A _Bruno Berselli_, Dec 03 2012