OFFSET
0,2
COMMENTS
The sequence represents a noised binary mask.
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(n) = 2*a(n-1) - a(n-2) + 2*a(n-3), with a(0)=1, a(1)=3, a(2)=4. - Harvey P. Dale, Jan 17 2012
G.f.: (1+x-x^2)/((1-2*x)*(1+x^2)). - R. J. Mathar, Nov 07 2015
MATHEMATICA
With[{c=Pi/2}, Table[2^n+Sin[c n], {n, 0, 40}]] (* or *) LinearRecurrence[ {2, -1, 2}, {1, 3, 4}, 40] (* Harvey P. Dale, Jan 17 2012 *)
PROG
(Magma) I:=[1, 3, 4]; [n le 3 select I[n] else 2*Self(n-1) -Self(n-2) +2*Self(n-3): n in [1..51]]; // G. C. Greubel, Apr 07 2023
(SageMath)
@CachedFunction
def a(n): # a = A100455
if (n<3): return (1, 3, 4)[n]
else: return 2*a(n-1) - a(n-2) + 2*a(n-3)
[a(n) for n in range(81)] # G. C. Greubel, Apr 07 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Konstantin Loutski (kilout(AT)yandex.ru), Nov 22 2004
STATUS
approved