OFFSET
0,2
COMMENTS
Suppose that s = (s(n)) and t = (t(n)) are sequences of numbers and h > 0 and k > 0. The lower (h, k)-midsequence of s and t is floor(h*s + k*t); the upper (h, k)-midsequence of s and t is ceiling(h*s + k*t).
LINKS
Index entries for linear recurrences with constant coefficients, signature (3,-3,2,-3,3,-1).
FORMULA
a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) - 3*a(n-4) + 3*a(n-5) - a(n-6), with (a(0),...,a(5)) = (0,2,7,18,38,67).
G.f.: x*(2 + x + 3*x^2 + x^3 - x^4)/((-1 + x)^4*(1 + x + x^2)).
EXAMPLE
MATHEMATICA
f[n_] := n^2; g[n_] := n^3; r = 1; s = 1/3;
u[n_] := Floor[r*f[n] + s*g[n]];
v[n_] := Ceiling[r*f[n] + s*g[n]];
Table[u[n], {n, 0, z}] (* A393346 *)
Table[v[n], {n, 0, z}] (* A393347 *)
(* Also *)
LinearRecurrence[{3, -3, 2, -3, 3, -1}, {0, 1, 6, 18, 37, 66}, 50] (* A393346 *)
LinearRecurrence[{3, -3, 2, -3, 3, -1}, {0, 2, 7, 18, 38, 67}, 50] (* A393347 *)
PROG
(Python)
def A393347(n): return (lambda x:x[0]+bool(x[1]))(divmod(n**2*(n+3), 3)) # Chai Wah Wu, Feb 23 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Feb 12 2026
STATUS
approved
