login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A070402 a(n) = 2^n mod 5. 7
1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1, 2, 4, 3, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
Periodic with period 4: [1, 2, 4, 3]. - Washington Bomfim, Nov 23 2010
LINKS
FORMULA
From R. J. Mathar, Apr 13 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3).
G.f.: (1 + x + 3*x^2) / ((1-x)*(1+x^2)). (End)
From Washington Bomfim, Nov 23 2010: (Start)
a(n) = 1 + (15*r^2 - 5*r - 4*r^3)/6, where r = n mod 4.
a(n) = A000689(n) - 5*floor(((n-1) mod 4)/2) for n>0. (End)
E.g.f.: (1/2)*(5*exp(x) - 3*cos(x) - sin(x)). - G. C. Greubel, Mar 19 2016
MAPLE
A070402 := proc(n) op((n mod 4)+1, [1, 2, 4, 3]) ; end proc: # R. J. Mathar, Feb 05 2011
MATHEMATICA
PadRight[{}, 100, {1, 2, 4, 3}] (* or *) CoefficientList[Series[(1 + 2 x + 4 x^2 + 3 x^3) / (1 - x^4), {x, 0, 100}], x] (* Vincenzo Librandi, Mar 25 2016 *)
PowerMod[2, Range[0, 120], 5] (* Harvey P. Dale, Sep 16 2020 *)
PROG
(Sage) [power_mod(2, n, 5) for n in range(0, 105)] # Zerinvary Lajos, Jun 08 2009
(PARI) for(n=0, 80, x=n%4; print1(1 + (15*x^2 -5*x -4*x^3)/6, ", ")) \\ Washington Bomfim, Nov 23 2010
(Magma) [Modexp(2, n, 5): n in [0..100]]; // Bruno Berselli, Mar 23 2016
(GAP) List([0..83], n->PowerMod(2, n, 5)); # Muniru A Asiru, Feb 01 2019
CROSSREFS
Cf. A173635.
Sequence in context: A229802 A106581 A317612 * A125941 A347270 A275117
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 12 2002
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 10:31 EDT 2024. Contains 371791 sequences. (Running on oeis4.)