OFFSET
0,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (-1,2,2).
FORMULA
MATHEMATICA
LinearRecurrence[{-1, 2, 2}, {1, 2, 3}, 50] (* Harvey P. Dale, Apr 03 2013 *)
PROG
(Python)
def A140407(n): return 2 if n == 1 else (1<<(n>>1))|1 if n&1 else -1^(-2<<(n>>1)) # Chai Wah Wu, Dec 21 2022
(PARI) a(n)=([0, 1, 0; 0, 0, 1; 2, 2, -1]^n*[1; 2; 3])[1, 1] \\ Charles R Greathouse IV, Jun 03 2026
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Paul Curtz, Jun 16 2008
EXTENSIONS
Edited and extended by R. J. Mathar, Jul 08 2008
STATUS
approved
