login
A100720
Expansion of g.f.: (3+x+2*x^2-2*x^3)/((1-2*x)*(1+x^2)).
1
3, 7, 13, 23, 47, 97, 193, 383, 767, 1537, 3073, 6143, 12287, 24577, 49153, 98303, 196607, 393217, 786433, 1572863, 3145727, 6291457, 12582913, 25165823, 50331647, 100663297, 201326593, 402653183, 805306367, 1610612737, 3221225473, 6442450943, 12884901887
OFFSET
0,1
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
Sequence in context: A048465 A049112 A349793 * A297852 A297953 A084898
KEYWORD
nonn,easy
AUTHOR
Creighton Dement, Dec 06 2004
STATUS
approved