OFFSET
0,1
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1,2).
FORMULA
a(0)=3 and for n>1: a(n)= 3*2^n+1 if n(mod 4)=1 or 2; otherwise 3*2^n-1. - R. Piyo (nagoya314(AT)yahoo.com), Dec 12 2004
From G. C. Greubel, Nov 16 2022: (Start)
a(n) = [n=0] + 3*2^n - (-1)^floor((n+1)/2).
E.g.f.: 1 + 3*exp(2*x) - cos(x) + sin(x). (End)
MATHEMATICA
LinearRecurrence[{2, -1, 2}, {3, 7, 13, 23}, 41] (* G. C. Greubel, Nov 16 2022 *)
PROG
(Magma) [3] cat [3*2^n - (-1)^Floor((n+1)/2): n in [1..40]]; // G. C. Greubel, Nov 16 2022
(SageMath)
def A100720(n): return int(n==0) + 3*2^n - (-1)^((n+1)//2)
[A100720(n) for n in range(40)] # G. C. Greubel, Nov 16 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Creighton Dement, Dec 06 2004
STATUS
approved