login
A070347
a(n) = 2^n mod 21.
2
1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11, 1, 2, 4, 8, 16, 11
OFFSET
0,2
FORMULA
From R. J. Mathar, Apr 13 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3) - a(n-4) + a(n-5).
G.f.: (1 + x + 3*x^2 + 5*x^3 + 11*x^4)/ ((1-x) * (1+x+x^2) * (1-x+x^2)). (End)
a(n) = a(n-6). - G. C. Greubel, Mar 11 2016
MATHEMATICA
PowerMod[2, Range[0, 50], 21] (* G. C. Greubel, Mar 11 2016 *)
LinearRecurrence[{1, -1, 1, -1, 1}, {1, 2, 4, 8, 16}, 120] (* or *) PadRight[{}, 120, {1, 2, 4, 8, 16, 11}] (* Harvey P. Dale, Mar 19 2016 *)
PROG
(Sage) [power_mod(2, n, 21)for n in range(0, 90)] # Zerinvary Lajos, Nov 03 2009
(PARI) a(n)=lift(Mod(2, 21)^n) \\ Charles R Greathouse IV, Mar 22 2016
(GAP) List([0..83], n->PowerMod(2, n, 21)); # Muniru A Asiru, Jan 31 2019
CROSSREFS
Sequence in context: A366031 A167421 A020954 * A342072 A095915 A208278
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 12 2002
STATUS
approved