%I #26 Oct 19 2022 10:30:35
%S 3,8,3,8,15,24,35,48,63,80,99,120,143,168,195,224,255,288,323,360,399,
%T 440,483,528,575,624,675,728,783,840,899,960,1023,1088,1155,1224,1295,
%U 1368,1443,1520,1599,1680,1763,1848,1935,2024,2115,2208,2303,2400,2499
%N Least k > 0 for n > 0 such that (n^2 + 1)*(k^2) + (n^2 + 1)*k + 1 = j^2 where j sequence = A106229.
%C For (n^2 + 1)*(k^2) + (n^2 +1)*k + 1 = j^2 there is a sequence k(i,n) with a recurrence.
%C For n=1, k(1,1) = 0, k(2,1) = 3, k(i,1) = 6*k(i-1,1) + 2 - k(i-2,1).
%C For n=2, k(1,2) = 1, k(2,2) = 19, k(i,2) = 18*k(i-1,2) + 8 - k(i-2,2).
%C For n>2, k(1,n) = 0, k(2,n) = n^2 - 2*n, k(3,n) = n^2 + 2*n, k(4,n) = (4*n^2 + 2)*k(2,n) + 2*n^2 then k(i,n) = (4*n^2 + 2)*k(i-2,n) + 2*n^2 - k(i-4,n). As i increases the ratio j(i,n)/k(i,n) tends to sqrt(n^2 + 1).
%H G. C. Greubel, <a href="/A106230/b106230.txt">Table of n, a(n) for n = 1..5000</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1).
%F For n > 2, a(n) = n^2 - 2*n.
%F a(n) = A005563(n-2), n>2. - _R. J. Mathar_, Aug 28 2008
%F G.f.: (3 - x - 12*x^2 + 20*x^3 - 8*x^4)/(1 - x)^3. - _G. C. Greubel_, May 11 2017
%t CoefficientList[Series[(-3 + z + 12*z^2 - 20*z^3 + 8*z^4)/(-1 + z)^3, {z, 0, 60}], z] (* _Vladimir Joseph Stephan Orlovsky_, Feb 17 2012 *)
%t LinearRecurrence[{3,-3,1},{3,8,3,8,15},60] (* _Harvey P. Dale_, Jul 05 2022 *)
%o (PARI) x='x+O('x^50); Vec((3-x-12*x^2+20*x^3-8*x^4)/(1-x)^3) \\ _G. C. Greubel_, May 11 2017
%o (PARI) a(n)=n*if(n>2, n-2, n+2) \\ _Charles R Greathouse IV_, Oct 19 2022
%Y Cf. A003777, A005563, A005899, A106229.
%K nonn,easy
%O 1,1
%A _Pierre CAMI_, Apr 26 2005