A112132 Period 4: repeat [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, 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, 1, 3, 1, 7, 1, 3, 1, 7, 1, 3, 1, 7, 1, 3, 1, 7, 1, 3, 1, 7, 1, 3, 1
Offset: 1
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).
Programs
-
Magma
&cat [[1, 3, 1, 7]^^30]; // Wesley Ivan Hurt, Jul 09 2016
-
Maple
seq(op([1, 3, 1, 7]), n=1..50); # Wesley Ivan Hurt, Jul 09 2016
-
Mathematica
PadRight[{}, 100, {1, 3, 1, 7}] (* Wesley Ivan Hurt, Jul 09 2016 *)
-
PARI
a(n)=1+2*((n-1)%2)*((n-1)%4); \\ Jaume Oliver Lafont, Aug 28 2009; corrected by Antti Karttunen, Mar 31 2013
-
PARI
a(n)=[1,3,1,7][1+(n-1)%4]; \\ Joerg Arndt, Apr 02 2013
-
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
Formula
a(n+1) = 3-2*sin(Pi*n/2)-2*(-1)^n. - R. J. Mathar, Oct 08 2011
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
From Wesley Ivan Hurt, Jul 09 2016: (Start)
G.f.: x*(1+3*x+x^2+7*x^3)/(1-x^4).
a(n) = a(n-4) for n>4.
a(2n) = 5+2*(-1)^n, a(2n-1) = 1. (End)
Dirichlet g.f.: zeta(s)*(1+2^(1-s)+4^(1-s)). - Amiram Eldar, Jan 03 2023