A070347 a(n) = 2^n mod 21.
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
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1,-1,1).
Programs
-
GAP
List([0..83],n->PowerMod(2,n,21)); # Muniru A Asiru, Jan 31 2019
-
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 *)
-
PARI
a(n)=lift(Mod(2,21)^n) \\ Charles R Greathouse IV, Mar 22 2016
-
Sage
[power_mod(2,n,21)for n in range(0,90)] # Zerinvary Lajos, Nov 03 2009
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