A084642 A Jacobsthal ratio.
1, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (0,1).
Programs
-
Magma
[1,3] cat [1+ (n mod 2): n in [2..120]]; // G. C. Greubel, Mar 20 2023
-
Mathematica
Table[(3-(-1)^n)/2 +Boole[n==1], {n,0,120}] (* G. C. Greubel, Mar 20 2023 *)
-
SageMath
[1 + (n%2) + int(n==1) for n in range(121)] # G. C. Greubel, Mar 20 2023
Formula
a(n) = floor((2^(n+2) - (-1)^(n+2))/(2^(n+1) - (-1)^(n+1))).
From G. C. Greubel, Mar 20 2023: (Start)
a(n) = A000034(n) + [n=1].
a(n) = a(n-2), for n > 3, with a(0) = 1, a(1) = 3, a(2) = 1, a(3) = 2.
G.f.: (1 + 3*x - x^3)/(1-x^2).
E.g.f.: (1/2)*(2*x + 3*exp(x) - exp(-x)). (End)
Comments