A214996 Power floor-ceiling sequence of 2+sqrt(2).
3, 11, 37, 127, 433, 1479, 5049, 17239, 58857, 200951, 686089, 2342455, 7997641, 27305655, 93227337, 318298039, 1086737481, 3710353847, 12667940425, 43251054007, 147668335177, 504171232695, 1721348260425, 5877050576311, 20065505784393, 68507921984951
Offset: 0
Examples
a(0) = floor(r) = 3, where r = 2+sqrt(2). a(1) = ceiling(3*r) = 11; a(2) = floor(11*r) = 37.
Links
- Clark Kimberling, Table of n, a(n) for n = 0..250
- Index entries for linear recurrences with constant coefficients, signature (3,2,-2).
Programs
-
Magma
Q:=Rationals(); R
:=PowerSeriesRing(Q, 40); Coefficients(R!((3+2*x-2*x^2)/(1-3*x-2*x^2+2*x^3))) // G. C. Greubel, Feb 02 2018 -
Mathematica
x = 2 + Sqrt[2]; z = 30; (* z = # terms in sequences *) z1 = 100; (* z1 = # digits in approximations *) f[x_] := Floor[x]; c[x_] := Ceiling[x]; p1[0] = f[x]; p2[0] = f[x]; p3[0] = c[x]; p4[0] = c[x]; p1[n_] := f[x*p1[n - 1]] p2[n_] := If[Mod[n, 2] == 1, c[x*p2[n - 1]], f[x*p2[n - 1]]] p3[n_] := If[Mod[n, 2] == 1, f[x*p3[n - 1]], c[x*p3[n - 1]]] p4[n_] := c[x*p4[n - 1]] Table[p1[n], {n, 0, z}] (* A007052 *) Table[p2[n], {n, 0, z}] (* A214996 *) Table[p3[n], {n, 0, z}] (* A214997 *) Table[p4[n], {n, 0, z}] (* A007070 *)
-
PARI
Vec((3 + 2*x - 2*x^2) / ((1 + x)*(1 - 4*x + 2*x^2)) + O(x^40)) \\ Colin Barker, Nov 13 2017
Formula
a(n) = ceiling(x*a(n-1)) if n is odd, a(n) = floor(x*a(n-1)) if n is even, where x = 2+sqrt(2) and a(0) = floor(x).
a(n) = 3*a(n-1) + 2*a(n-2) - 2*a(n-3).
G.f.: (3 + 2*x - 2*x^2)/(1 - 3*x - 2*x^2 + 2*x^3).
a(n) = (1/7)*((-1)^(1+n) + (11-8*sqrt(2))*(2-sqrt(2))^n + (2+sqrt(2))^n*(11+8*sqrt(2))). - Colin Barker, Nov 13 2017
Comments