OFFSET
1,1
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
a(n) = 4*n + 6 + (-1)^n + 2*(-1)^((2*n+(-1)^n-1)/4) for n>=0.
G.f. x*(9+2*x+2*x^2+2*x^3+x^4) / ( (1+x)*(x^2+1)*(x-1)^2 ). - R. J. Mathar, Mar 10 2013
a(n+4) = a(n) + 16. - Alexander R. Povolotsky, Mar 15 2013
MATHEMATICA
CoefficientList[Series[x*(9 + 2*x + 2*x^2 + 2*x^3 + x^4)/((1 + x)*(x^2 + 1)*(x - 1)^2), {x, 0, 50}], x] (* G. C. Greubel, Feb 22 2017 *)
PROG
(Magma)
XOR := func<a, b | Seqint([ (adigs[i] + bdigs[i]) mod 2 : i in [1..n]], 2)
where adigs := Intseq(a, 2, n)
where bdigs := Intseq(b, 2, n)
where n := 1 + Ilog2(Max([a, b, 1]))>;
m:=9;
for n in [1 .. 500] do
if (XOR(n, m) eq n-m) then n; end if;
end for;
(PARI) x='x+O('x^50); Vec(x*(9+2*x+2*x^2+2*x^3+x^4) / ( (1+x)*(x^2+1)*(x-1)^2 )) \\ G. C. Greubel, Feb 22 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Brad Clardy, Mar 09 2013
STATUS
approved