A316742 Stepping through the Mersenne sequence (A000225) one step back, two steps forward.
1, 0, 3, 1, 7, 3, 15, 7, 31, 15, 63, 31, 127, 63, 255, 127, 511, 255, 1023, 511, 2047, 1023, 4095, 2047, 8191, 4095, 16383, 8191, 32767, 16383, 65535, 32767, 131071, 65535, 262143, 131071, 524287, 262143, 1048575, 524287, 2097151, 1048575, 4194303, 2097151, 8388607, 4194303
Offset: 0
Examples
Let 1. The first four terms are 1, (1-1)/2 = 0, 2*1+1 = 3, 1. Let 4*1+3 = 7. The next four terms are 7, (7-1)/2 = 3, 2*7+1 = 15, 7. Let 4*7+3 = 31. The next four terms are 31, (31-1)/2 = 15, 2*31+1 = 63, 31; etc.
Links
- Jim Singh and others, Fascinating periodic sequence pairs, Mersenne Forum thread, July 2018.
- Index entries for linear recurrences with constant coefficients, signature (1,2,-2).
Programs
-
GAP
a:=[1,0,3];; for n in [4..45] do a[n]:=a[n-1]+2*a[n-2]-2*a[n-3]; od; a; # Muniru A Asiru, Jul 14 2018
-
Maple
seq(coeff(series((1-x+x^2)/((1-x)*(1-2*x^2)), x,n+1),x,n),n=0..45); # Muniru A Asiru, Jul 14 2018
-
Mathematica
CoefficientList[Series[(1 - x + x^2)/((1 - x) (1 - 2 x^2)), {x, 0, 42}], x] (* Michael De Vlieger, Jul 13 2018 *) LinearRecurrence[{1, 2, -2}, {1, 0, 3}, 46] (* Robert G. Wilson v, Jul 21 2018 *)
Formula
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) for n>2, a(0)=1, a(1)=0, a(2)=3.
From Bruno Berselli, Jul 12 2018: (Start)
G.f.: (1 - x + x^2)/((1 - x)*(1 - 2*x^2)).
a(n) = 2*a(n-2) + 1 for n>1, a(0)=1, a(1)=0.
a(n) = (1 + (-1)^n)*(2^(n/2) - 2^((n-3)/2)) + 2^((n-1)/2) - 1.
Therefore: a(4*k) = 2*4^k - 1, a(4*k+1) = 4^k - 1, a(4*k+2) = 4^(k+1) - 1, a(4*k+3) = 2*4^k - 1. (End)