A010684 Period 2: repeat (1,3); offset 0.
1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1
Offset: 0
Examples
0.131313131313131313131313131313131313131313131...
References
- Carl Schick, Trigonometrie und unterhaltsame Zahlentheorie, Bokos Druck, Zürich, 2003 (ISBN 3-9522917-0-6). Tables 3.1 to 3.10, for odd p = 3..113 (with gaps), pp. 158-166.
Links
- Index entries for linear recurrences with constant coefficients, signature (0,1).
Programs
-
Maple
[seq (modp((2*n+1),4),n=0..80)]; # Zerinvary Lajos, Nov 30 2006
-
Mathematica
Table[2-(-1)^n, {n, 0, 100}] (* Wesley Ivan Hurt, Mar 24 2014 *) PadRight[{},120,{1,3}] (* Harvey P. Dale, Mar 11 2025 *)
-
PARI
a(n)=1+n%2*2 \\ Charles R Greathouse IV, Dec 28 2011
-
Python
def A010684(n): return 3 if n&1 else 1 # Chai Wah Wu, Jan 17 2023
-
Sage
[power_mod(3, n, 8)for n in range(0, 81)] # Zerinvary Lajos, Nov 24 2009
Formula
From Paul Barry, Apr 29 2003: (Start)
a(n) = 2-(-1)^n.
G.f.: (1+3x)/((1-x)(1+x)).
E.g.f.: 2*exp(x) - exp(-x). (End)
a(n) = 3^(n mod 2). - Jaume Oliver Lafont, Mar 27 2009
a(n) = 7^n mod 4. - Vincenzo Librandi, Feb 07 2011
a(n) = 1 + 2*(n mod 2). - Wesley Ivan Hurt, Jul 06 2013
Comments