%I #115 Jul 11 2023 12:38:31
%S 1,3,11,41,153,571,2131,7953,29681,110771,413403,1542841,5757961,
%T 21489003,80198051,299303201,1117014753,4168755811,15558008491,
%U 58063278153,216695104121,808717138331,3018173449203,11263976658481
%N a(n) = 4*a(n-1) - a(n-2) with a(1) = 1, a(2) = 3.
%C See A001835 for another version.
%C Greedy frac multiples of sqrt(3): a(1)=1, Sum_{n>0} frac(a(n)*x)) < 1 at x=sqrt(3).
%C The n-th greedy frac multiple of x is the smallest integer that does not cause Sum_{k=1..n} frac(a(k)*x) to exceed unity; an infinite number of terms appear as the denominators of the convergents to the continued fraction of x.
%C Binomial transform of A002605. - _Paul Barry_, Sep 17 2003
%C In general, Sum_{k=0..n} binomial(2n-k,k)*j^(n-k) = (-1)^n* U(2n, i*sqrt(j)/2), i=sqrt(-1). - _Paul Barry_, Mar 13 2005
%C The Hankel transform of this sequence is [1,2,0,0,0,0,0,0,0,0,0,...]. - _Philippe Deléham_, Nov 21 2007
%C From _Richard Choulet_, May 09 2010: (Start)
%C This sequence is a particular case of the following situation:
%C a(0)=1, a(1)=a, a(2)=b with the recurrence relation a(n+3) = (a(n+2)*a(n+1)+q)/a(n)
%C where q is given in Z to have Q = (a*b^2 + q*b + a + q)/(a*b) itself in Z.
%C The g.f is f: f(z) = (1 + a*z + (b-Q)*z^2 + (a*b + q - a*Q)*z^3)/(1 - Q*z^2 + z^4);
%C so we have the linear recurrence: a(n+4) = Q*a(n+2) - a(n).
%C The general form of a(n) is given by:
%C a(2*m) = Sum_{p=0..floor(m/2)} (-1)^p*binomial(m-p,p)*Q^(m-2*p) + (b-Q)*Sum_{p=0..floor((m-1)/2)} (-1)^p*binomial(m-1-p,p)*Q^(m-1-2*p) and
%C a(2*m+1) = a*Sum_{p=0..floor(m/2)} (-1)^p*binomial(m-p,p)*Q^(m-2*p) + (a*b+q-a*Q)*Sum_{p=0..floor((m-1)/2)} (-1)^p*binomial(m-1-p,p)*Q^(m-1-2*p).
%C (End)
%C x-values in the solution to 3*x^2 - 2 = y^2. - _Sture Sjöstedt_, Nov 25 2011
%C From _Wolfdieter Lang_, Oct 12 2020: (Start)
%C [X(n) = S(n, 4) - S(n-1, 4), Y(n) = X(n-1)] gives all positive solutions of X^2 + Y^2 - 4*X*Y = -2, for n = -oo..+oo, where the Chebyshev S-polynomials are given in A049310, with S(-1, 0) = 0, and S(-|n|, x) = - S(|n|-2, x), for |n| >= 2.
%C This binary indefinite quadratic form has discriminant D = +12. There is only this family representing -2 properly with X and Y positive, and there are no improper solutions.
%C See also the preceding comment by _Sture Sjöstedt_.
%C See the formula for a(n) = X(n-1), for n >= 1, in terms of S-polynomials below.
%C This comment is inspired by a paper by _Robert K. Moniot_ (private communication). See his Oct 04 2020 comment in A027941 related to the case of x^2 + y^2 - 3*x*y = -1 (special Markov solutions). (End)
%C a(n) is also the output of Tesler's formula for the number of perfect matchings of an m x n Mobius band where m and n are both even, specialized to m=2. (The twist is on the length-n side.) - _Sarah-Marie Belcastro_, Feb 15 2022
%H G. C. Greubel, <a href="/A079935/b079935.txt">Table of n, a(n) for n = 1..1000</a>
%H Dalen Dockery, Marie Jameson, and Samuel Wilson, <a href="https://arxiv.org/abs/2307.02579">d-Fold Partition Diamonds</a>, arXiv:2307.02579 [math.NT], 2023.
%H Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>
%H Jaime Rangel-Mondragon, <a href="https://web.archive.org/web/20190411024906/http://www.mathematica-journal.com/issue/v9i3/polyominoes.html">Polyominoes and Related Families</a>, The Mathematica Journal, 9:3 (2005), pp. 609-640.
%H G. Tesler, <a href="https://doi.org/10.1006/jctb.1999.1941">Matchings in graphs on non-orientable surfaces</a>, Journal of Combinatorial Theory B, 78(2000), 198-231.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (4,-1).
%F For n > 0, a(n) = ceiling( (2+sqrt(3))^n/(3+sqrt(3)) ).
%F From _Paul Barry_, Sep 17 2003: (Start)
%F G.f.: (1-x)/(1-4*x+x^2).
%F E.g.f.: exp(2*x)*(sinh(sqrt(3)*x)/sqrt(3) + cosh(sqrt(3)*x)).
%F a(n) = ( (3+sqrt(3))*(2+sqrt(3))^n + (3-sqrt(3))*(2-sqrt(3))^n )/6 (offset 0). (End)
%F a(n) = Sum_{k=0..n} binomial(2*n-k, k)*2^(n-k). - _Paul Barry_, Jan 22 2005 [offset 0]
%F a(n) = (-1)^n*U(2*n, i*sqrt(2)/2), U(n, x) Chebyshev polynomial of second kind, i=sqrt(-1). - _Paul Barry_, Mar 13 2005 [offset 0]
%F a(n) = Jacobi_P(n,-1/2,1/2,2)/Jacobi_P(n,-1/2,1/2,1). - _Paul Barry_, Feb 03 2006 [offset 0]
%F a(n) = sqrt(2+(2-sqrt(3))^(2*n-1) + (2+sqrt(3))^(2*n-1))/sqrt(6). - _Gerry Martens_, Jun 05 2015
%F a(n) = (1/2 + sqrt(3)/6)*(2-sqrt(3))^n + (1/2 - sqrt(3)/6)*(2+sqrt(3))^n. - _Robert Israel_, Jun 05 2015
%F a(n) = S(n-1,4) - S(n-2,4) = (-1)^(n-1)*S(2*(n-1), i*sqrt(2)), with Chebyshev S-polynomials (A049310), the imaginary unit i, S(-1, x) = 0, for n >= 1. See also the formula above by _Paul Barry_ (with offset 0). - _Wolfdieter Lang_, Oct 12 2020
%F a(n) = sqrt(2/3)*cosh((-1 - 2*n) arccsch(sqrt(2))), where arccsch is the inverse hyperbolic cosecant function (with offset 0). - _Peter Luschny_, Oct 13 2020
%e a(4) = 41 since frac(1*x) + frac(3*x) + frac(11*x) + frac(41*x) < 1, while frac(1*x) + frac(3*x) + frac(11*x) + frac(k*x) > 1 for all k > 11 and k < 41.
%p f:= gfun:-rectoproc({a(n) = 4*a(n-1) - a(n-2),a(1)=1,a(2)=3}, a(n), remember):
%p seq(f(n),n=1..30); # _Robert Israel_, Jun 05 2015
%t a[n_] := (MatrixPower[{{1, 2}, {1, 3}}, n].{{1}, {1}})[[1, 1]]; Table[ a[n], {n, 0, 23}]] (* _Robert G. Wilson v_, Jan 13 2005 *)
%t LinearRecurrence[{4,-1},{1,3},30] (* or *) CoefficientList[Series[ (1-x)/(1-4x+x^2),{x,0,30}],x] (* _Harvey P. Dale_, Apr 26 2011 *)
%t a[n_] := Sqrt[2/3] Cosh[(-1 - 2 n) ArcCsch[Sqrt[2]]];
%t Table[Simplify[a[n-1]], {n, 1, 12}] (* _Peter Luschny_, Oct 13 2020 *)
%o (Sage) [lucas_number1(n,4,1)-lucas_number1(n-1,4,1) for n in range(1, 25)] # _Zerinvary Lajos_, Apr 29 2009
%o (Haskell)
%o a079935 n = a079935_list !! (n-1)
%o a079935_list =
%o 1 : 3 : zipWith (-) (map (4 *) $ tail a079935_list) a079935_list
%o -- _Reinhard Zumkeller_, Aug 14 2011
%o (Magma) I:=[1,3]; [n le 2 select I[n] else 4*Self(n-1)-Self(n-2): n in [1..40]]; // _Vincenzo Librandi_, Jun 06 2015
%o (PARI) a(n)=([0,1; -1,4]^(n-1)*[1;3])[1,1] \\ _Charles R Greathouse IV_, Mar 18 2017
%o (PARI) my(x='x+O('x^30)); Vec((1-x)/(1-4*x+x^2)) \\ _G. C. Greubel_, Feb 25 2019
%Y Cf. A002530 (denominators of convergents to sqrt(3)), A079934, A079936, A001353.
%Y Cf. A001835 (same except for the first term).
%Y Row 4 of array A094954.
%Y Cf. similar sequences listed in A238379.
%K nonn,easy
%O 1,2
%A _Benoit Cloitre_ and _Paul D. Hanna_, Jan 20 2003