%I #26 Nov 21 2022 00:54:23
%S 67,1238,3867,7954,13499,20502,28963,38882,50259,63094,77387,93138,
%T 110347,129014,149139,170722,193763,218262,244219,271634,300507,
%U 330838,362627,395874,430579,466742,504363,543442,583979,625974,669427,714338
%N a(n) = 729*n^2 - 1016*n + 354.
%C The identity (531441*n^2 - 740664*n + 258065)^2 - (729*n^2 - 1016*n + 354)*(19683*n - 13716)^2 = 1 can be written as A157667(n)^2 - a(n)*A157666(n)^2 = 1.
%C The continued fraction expansion of sqrt(a(n)) is [27*n-19; {5, 2, 1, 1, 27*n-20, 1, 1, 2, 5, 54*n-38}]. - _Magus K. Chu_, Nov 20 2022
%H Vincenzo Librandi, <a href="/A157665/b157665.txt">Table of n, a(n) for n = 1..10000</a>
%H Vincenzo Librandi, <a href="http://mathforum.org/kb/message.jspa?messageID=5773864&tstart=0">X^2-AY^2=1</a> [Dead link]
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1).
%F a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3).
%F G.f.: x*(67 + 1037*x + 354*x^2)/(1-x)^3.
%F E.g.f.: (1 - 287*x + 729*x^2)*exp(x) - 354. - _G. C. Greubel_, Nov 17 2018
%t LinearRecurrence[{3,-3,1},{67,1238,3867},40]
%o (Magma) I:=[67, 1238, 3867]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+1*Self(n-3): n in [1..40]];
%o (PARI) a(n) = 729*n^2 - 1016*n + 354.
%o (Sage) [729*n^2 - 1016*n + 354 for n in (1..40)] # _G. C. Greubel_, Nov 17 2018
%o (GAP) List([1..40], n -> 729*n^2 - 1016*n + 354); # _G. C. Greubel_, Nov 17 2018
%Y Cf. A157666, A157667.
%K nonn,easy
%O 1,1
%A _Vincenzo Librandi_, Mar 04 2009