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!)
A109008 a(n) = gcd(n,4). 12
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
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: A322574 A030787 A176218 * A187025 A074695 A069098
KEYWORD
nonn,easy,mult
AUTHOR
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 March 18 22:56 EDT 2024. Contains 370952 sequences. (Running on oeis4.)