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

%I #29 Dec 01 2021 05:17:41

%S 12,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,4,1,6,1,4,

%T 3,2,1,12,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,4,1,

%U 6,1,4,3,2,1,12,1,2,3,4,1,6,1,4,3,2,1,12,1,2,3,4,1,6,1,4,3,2,1,12,1,2

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

%C Periodic, with period = 12. - _Harvey P. Dale_, Dec 20 2018

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

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

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

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

%F Dirichlet g.f.: zeta(s)*(1 + 1/2^s + 2/4^s)*(1 + 2/3^s). - _R. J. Mathar_, Apr 08 2011

%t GCD[Range[0,100],12] (* or *) PadRight[{},120,{12,1,2,3,4,1,6,1,4,3,2,1}] (* _Harvey P. Dale_, Dec 20 2018 *)

%o (Python)

%o from math import gcd

%o def a(n): return gcd(n, 12)

%o print([a(n) for n in range(99)]) # _Michael S. Branicky_, Dec 01 2021

%Y Cf. A109004.

%K nonn,easy,mult

%O 0,1

%A _Mitch Harris_