login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A109008 a(n) = GCD(n,4). 11
4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Period 4: repeat [4, 1, 2, 1]. - Wesley Ivan Hurt, Aug 31 2014

LINKS

Table of n, a(n) for n=0..100.

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

FORMULA

a(n) = 1 + [2|n] + 2*[4|n] = 2 + (-1)^n + cos(n*Pi/2), where [x|y] = 1 when x divides y, 0 otherwise.

a(n) = a(n-4) for n>3.

Multiplicative with a(p^e) = GCD(p^e, 4). - David W. Wilson, Jun 12 2005

Dirichlet g.f.: (1+1/2^s+2/4^s)*zeta(s). - R. J. Mathar, Feb 28 2011

G.f.: (4+x+2*x^2+x^3)/((1-x)*(1+x)*(1+x^2)). - R. J. Mathar, Apr 04 2011

a(n) = 1 + mod((n-1)^3, 4). - Wesley Ivan Hurt, Aug 31 2014

a(n) = 2 + cos(n*Pi) + cos(n*Pi/2). - Wesley Ivan Hurt, Jul 07 2016

E.g.f.: exp(-x) + 2*exp(x) + cos(x). - Ilya Gutkovskiy, Jul 07 2016

MAPLE

A109008:=n->gcd(n, 4): seq(A109008(n), n=0..100); # Wesley Ivan Hurt, Aug 31 2014

MATHEMATICA

Table[GCD[n, 4], {n, 0, 100}] (* Wesley Ivan Hurt, Aug 31 2014 *)

PROG

(Haskell)

a109008 = gcd 4

a109008_list = cycle [4, 1, 2, 1]  -- Reinhard Zumkeller, Nov 25 2013

(MAGMA) [Gcd(n, 4) : n in [0..100]]; // Wesley Ivan Hurt, Aug 31 2014

(PARI) a(n)=gcd(n, 4) \\ Charles R Greathouse IV, Oct 07 2015

CROSSREFS

Cf. A109004.

Sequence in context: A087230 A030787 A176218 * A187025 A074695 A069098

Adjacent sequences:  A109005 A109006 A109007 * A109009 A109010 A109011

KEYWORD

nonn,easy,mult

AUTHOR

Mitch Harris

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 26 09:52 EDT 2019. Contains 322472 sequences. (Running on oeis4.)