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

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
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

G. C. Greubel, Table of n, a(n) for n = 0..1000

Index entries for linear recurrences with constant coefficients, signature (1,-1,1).

FORMULA

From Paolo P. Lava, Feb 24 2010: (Start)

a(n) = (1/12)*(11*(n mod 4) + 8*((n+1) mod 4)-((n+2) mod 4) + 2*((n+3) mod 4)).

a(n) = (5/2) - (1/4)*((3-i)*i^n-(3+i)*(-i)^n), with i=sqrt(-1). (End)

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

Adjacent sequences: A070399 A070400 A070401 * A070403 A070404 A070405

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 December 7 01:51 EST 2022. Contains 358649 sequences. (Running on oeis4.)