%I #54 Feb 24 2024 01:13:12
%S 1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,
%T 1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,
%U 1,3,1,7,1,3,1,7,1,3,1,7,1,3,1,7,1,3,1
%N Period 4: repeat [1, 3, 1, 7].
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1).
%F a(n+1) = 3-2*sin(Pi*n/2)-2*(-1)^n. - _R. J. Mathar_, Oct 08 2011
%F Multiplicative with a(2) = 3, a(2^e) = 7 if e >= 2, a(p^e) = 1 otherwise. - _Antti Karttunen_, Mar 31 2013, typo corrected May 02 2020
%F From _Wesley Ivan Hurt_, Jul 09 2016: (Start)
%F G.f.: x*(1+3*x+x^2+7*x^3)/(1-x^4).
%F a(n) = a(n-4) for n>4.
%F a(2n) = 5+2*(-1)^n, a(2n-1) = 1. (End)
%F Dirichlet g.f.: zeta(s)*(1+2^(1-s)+4^(1-s)). - _Amiram Eldar_, Jan 03 2023
%p seq(op([1, 3, 1, 7]), n=1..50); # _Wesley Ivan Hurt_, Jul 09 2016
%t PadRight[{}, 100, {1, 3, 1, 7}] (* _Wesley Ivan Hurt_, Jul 09 2016 *)
%o (PARI) a(n)=1+2*((n-1)%2)*((n-1)%4); \\ _Jaume Oliver Lafont_, Aug 28 2009; corrected by _Antti Karttunen_, Mar 31 2013
%o (PARI) a(n)=[1,3,1,7][1+(n-1)%4]; \\ _Joerg Arndt_, Apr 02 2013
%o (PARI) A112132(n) = { my(f=factor(n)); prod(i=1,#f~,if(2==f[i,1],if(1==f[i,2],3,7),1)); }; \\ (implements the multiplicative formula) - _Antti Karttunen_, May 10 2020
%o (Magma) &cat [[1, 3, 1, 7]^^30]; // _Wesley Ivan Hurt_, Jul 09 2016
%Y First differences of A112062.
%Y Also half of the first differences of A112072. Cf. A112086.
%K nonn,mult,easy
%O 1,2
%A _Antti Karttunen_, Aug 28 2005