OFFSET
1,3
LINKS
Bruce Nye, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(2*n) = 2*n-1.
a(2*n-1) = 2*n*(n-1).
From Colin Barker, Apr 02 2014: (Start)
a(n) = 3*a(n-2) - 3*a(n-4) + a(n-6).
G.f.: x^2*(x^4-4*x-1) / ((x-1)^3*(x+1)^3). (End)
a(n) = n - 1 + (2*floor((n+2)/2)^2 - 2*floor((n+2)/2) - n + 1) * (n mod 2). - Wesley Ivan Hurt, Apr 02 2014
a(n) = (n-1)*(n+3-(n-1)*(-1)^n)/4. - Wesley Ivan Hurt, Dec 05 2023
EXAMPLE
a(1) = 0 because the numerator of: {(1-1) * ceiling(1/2) / 1 = 0 * 1 / 1 = (0 / 1)} = 0.
a(2) = 1 because the numerator of: {(2-1) * ceiling(2/2) / 2 = 1 * 1 / 2 = (1 / 2)} = 1.
a(3) = 4 because the numerator of: {(3-1) * ceiling(3/2) / 3 = 2 * 2 / 3 = (4 / 3)} = 4.
MATHEMATICA
Table[Numerator[(n - 1) Ceiling[n/2] / n], {n, 100}]
PROG
(PARI) concat(0, Vec(x^2*(x^4-4*x-1)/((x-1)^3*(x+1)^3) + O(x^67))) \\ Colin Barker, Apr 02 2014
(Magma) [(n-1)*(n+3-(n-1)*(-1)^n)/4 : n in [1..66]]; // Wesley Ivan Hurt, Dec 05 2023
(Python)
def A240134(n): return (m:=n>>1)*(m+1)<<1 if n&1 else (n&-2)-1 # Chai Wah Wu, May 07 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Apr 02 2014
STATUS
approved
