login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = a(n-1) - 2*a(n-2) with a(0) = 2, a(1) = 1.
15

%I #110 Jun 14 2024 09:41:42

%S 2,1,-3,-5,1,11,9,-13,-31,-5,57,67,-47,-181,-87,275,449,-101,-999,

%T -797,1201,2795,393,-5197,-5983,4411,16377,7555,-25199,-40309,10089,

%U 90707,70529,-110885,-251943,-30173,473713,534059,-413367,-1481485

%N a(n) = a(n-1) - 2*a(n-2) with a(0) = 2, a(1) = 1.

%C 4*2^n = A002249(n)^2 + 7*A001607(n)^2. See A077020, A077021.

%C Among presented initial elements of the sequence a(n), the maximal increasing or decreasing subsequences have length either 3 or 4. - _Roman Witula_, Aug 21 2012

%C This is the Lucas Sequence V_n(P, Q) = V_n(1, 2). U_n(1, 2) = A107920(n). - _Raphie Frank_, Dec 25 2013

%C The only numbers that occur more than once are 1=a(1)=a(4) and -5=a(3)=a(9). See Noam D. Elkies's posting in the Mathematics Stack Exchange link. - _Robert Israel_, Dec 21 2016

%H T. D. Noe, <a href="/A002249/b002249.txt">Table of n, a(n) for n = 0..500</a>

%H Paul Barry, <a href="https://arxiv.org/abs/2004.04577">On a Central Transform of Integer Sequences</a>, arXiv:2004.04577 [math.CO], 2020.

%H Mathematics Stack Exchange, <a href="http://math.stackexchange.com/questions/705877/an-exotic-sequence">An exotic sequence</a>, March 2014.

%H Mihai Prunescu, <a href="https://arxiv.org/abs/2406.06436">On other two representations of the C-recursive integer sequences by terms in modular arithmetic</a>, arXiv:2406.06436 [math.NT], 2024. See p. 18.

%H Mihai Prunescu and Lorenzo Sauras-Altuzarra, <a href="https://arxiv.org/abs/2405.04083">On the representation of C-recursive integer sequences by arithmetic terms</a>, arXiv:2405.04083 [math.LO], 2024. See p. 17.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lucas_sequence">Lucas Sequence</a>.

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (1,-2).

%F G.f.: (2-x)/(1-x+2x^2). - _Michael Somos_, Oct 18 2002

%F a(n) = trace(A^n) for the square matrix A=[1, -2; 1, 0]. - _Paul Barry_, Sep 05 2003

%F a(n) = 2^((n+2)/2)*cos(-n*acot(sqrt(7)/7)). - _Paul Barry_, Sep 06 2003

%F a(n) = (-1)^n*(2*A110512(n) - A001607(n)) = ((1 + i*sqrt(7))/2)^n + ((1 - i*sqrt(7))/2)^n. - _Roman Witula_, Aug 21 2012

%F G.f.: G(0), where G(k) = 1 + 1/(1 - x*(7*k+1)/(x*(7*k+8) + 2/G(k+1))); (continued fraction). - _Sergei N. Gladkovskii_, Jun 03 2013

%F (a(A060728(n) - 2))^2 = (A107920(2*(A060728(n)) - 4))^2 = 2^(A060728(n)) - 7 = A227078(n), the Ramanujan-Nagell squares. - _Raphie Frank_, Dec 25 2013

%F a(n) = [x^n] ( (1 + x + sqrt(1 + 2*x - 7*x^2))/2 )^n for n >= 1. - _Peter Bala_, Jun 23 2015

%F a(n) = (A107920(n+1) + 2*A107920(n+2) - A107920(n+3))/2. - _Raphie Frank_, Nov 28 2015

%F V_n(P,Q) = a(k*n) = ((a(k) + sqrt(-7))/2)^n + ((a(k) - sqrt(-7))/2)^n for k is in {1, 2, 3, 5, 13} = (A060728(n) - 2), P is in {1, -3, -5, 11, -181} = a(k), and Q is in {2, 4, 8, 32, 8192} = 2^k = (2*A076046(n) + 2) = (A227078(n) - 7)/4. P^2 - 4*Q = -7. - _Raphie Frank_, Dec 05 2015

%F From _Peter Bala_, Nov 16 2022: (Start)

%F The Gauss congruences hold: a(n*p^k) == a(n*p^(k-1)) (mod p^k) for all positive integers n and k and all primes p.

%F A268924(n) == a(3^n) (mod 3^n). (End)

%e We have a(2)-a(7) = a(5)-a(4) = a(6)+a(4) = a(11)-a(10) = a(12)+a(10)=10. Further the following relations: ((1+i*sqrt(7))/2)^4 + ((1-i*sqrt(7))/2)^4 = 1 and ((1+i*sqrt(7))/2)^8 + ((1-i*sqrt(7))/2)^8 = -31. - _Roman Witula_, Aug 21 2012

%e G.f. = 2 + x - 3*x^2 - 5*x^3 + x^4 + 11*x^5 + 9*x^6 - 13*x^7 - 31*x^8 + ...

%e From _Raphie Frank_, Dec 05 2015: (Start)

%e V_n(1, 2) = a(1*n) = ((a(1) + sqrt(-7))/2)^n + ((a(1) - sqrt(-7))/2)^n; a(1) = 1.

%e V_n(-3, 4) = a(2*n) = ((a(2) + sqrt(-7))/2)^n + ((a(2) - sqrt(-7))/2)^n; a(2) = -3.

%e V_n(-5, 8) = a(3*n) = ((a(3) + sqrt(-7))/2)^n + ((a(3) - sqrt(-7))/2)^n; a(3) = -5.

%e V_n(11, 32) = a(5*n) = ((a(5) + sqrt(-7))/2)^n + ((a(5) - sqrt(-7))/2)^n; a(5) = 11.

%e V_n(-181, 8192) = a(13*n) = ((a(13) + sqrt(-7))/2)^n + ((a(13) - sqrt(-7))/2)^n; a(13) = -181.

%e (End)

%p A002249 := proc(n) option remember; >if n = 1 then 1 elif n = 2 then -3 else A002249(n-1>)-2*A002249(n-2); fi; end;

%t LinearRecurrence[{1,-2}, {2,1}, 50] (* _Roman Witula_, Aug 21 2012 *)

%t a[ n_] := 2^(n/2) ChebyshevT[ n, 8^(-1/2)] 2; (* _Michael Somos_, Jun 02 2014 *)

%t a[ n_] := 2^Min[0, n] SeriesCoefficient[ (2 - x) / (1 - x + 2 x^2), {x, 0, Abs @ n}]; (* _Michael Somos_, Jun 02 2014 *)

%t Table[2 Re[((1 + I Sqrt[7])/2)^n], {n, 0, 40}] (* _Jean-François Alcover_, Jun 02 2017 *)

%o (PARI) {a(n) = if( n<0, 2^n * a(-n), polsym(2 - x + x^2, n)[n+1])}; /* _Michael Somos_, Jun 02 2014 */

%o (PARI) {a(n) = 2 * real( ((1 + quadgen(-28)) / 2)^n )}; /* _Michael Somos_, Jun 02 2014 */

%o (PARI) x='x+O('x^100); Vec((2-x)/(1-x+2*x^2)) \\ _Altug Alkan_, Dec 04 2015

%o (Sage) [lucas_number2(n,1,2) for n in range(0, 40)] # _Zerinvary Lajos_, Apr 30 2009

%o (Magma) I:=[2,1]; [n le 2 select I[n] else Self(n-1)-2*Self(n-2): n in [1..50]]; // _Vincenzo Librandi_, Nov 29 2015

%o (Python)

%o from sympy import sqrt, re, I

%o def a(n): return 2*re(((1 + I*sqrt(7))/2)**n)

%o print([a(n) for n in range(40)]) # _Indranil Ghosh_, Jun 02 2017

%Y Cf. A014551, A107920, A060728.

%K sign,easy

%O 0,1

%A _N. J. A. Sloane_, _Iwan Duursma_