login
a(n) = gcd(n,5).
7

%I #29 Oct 18 2019 10:23:52

%S 5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,

%T 1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,

%U 1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5,1,1,1,1,5

%N a(n) = gcd(n,5).

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).

%F a(n) = 1 + 4*[5|n], where [x|y] = 1 when x divides y, 0 otherwise.

%F a(n) = a(n-5).

%F Multiplicative with a(p^e, 5) = gcd(p^e, 5). - _David W. Wilson_, Jun 12 2005

%F From _R. J. Mathar_, Apr 04 2011: (Start)

%F Dirichlet g.f.: zeta(s)*(1+4/5^s).

%F G.f.: ( -5-x-x^2-x^3-x^4 ) / ( (x-1)*(1+x+x^2+x^3+x^4) ). (End)

%F a(n) = 4*floor(1/2*cos((2*n*Pi)/5)+1/2) + 1.

%F = 4*floor(((n-1) mod 5)/4) + 1. - _Gary Detlefs_, Dec 28 2011

%t GCD[Range[0,100],5] (* or *) PadRight[{},120,{5,1,1,1,1}] (* _Harvey P. Dale_, Jun 29 2018 *)

%o (PARI) a(n)=gcd(n,5) \\ _Charles R Greathouse IV_, Oct 07 2015

%Y Cf. A109004.

%K nonn,easy,mult

%O 0,1

%A _Mitch Harris_