OFFSET
1,2
COMMENTS
There is a second version of this sequence possible if we change the definition to a(1) = 2 and a(n) > 1, then the sequence will start 2, 4, 5, 8, 10, 7, 14, ... . It will after this continue in the same way as our actual sequence does (and would also extend the valid range of the recurrence formulas).
Start a(1) = 2 and value 1 allowed is A257794.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0,0,1,0,0,1,0,0,-1).
FORMULA
G.f.: x*(1 + 3*x + 7*x^2 + 4*x^3 + 7*x^4 + x^5 + 8*x^6 + 3*x^7 - 4*x^8 + 2*x^9 - x^10 + x^11 - 3*x^12 + x^14)/(1 - x^3 - x^6 + x^9).
a(n) = a(n-3) + a(n-6) - a(n-9) for n >= 16.
a((3*(2*n-1) - (-1)^n)/4) = (3*(2*n-1) - (-1)^n)/2, for n > 3.
a(6*n) = 6*n+1, for n > 1.
a(6*n+3) = 6*n+5, for n > 0.
a(n) = 30*n - 2*a(n-1) - 3*a(n-2) - 3*a(n-3) - 3*a(n-4) - 3*a(n-5) - 2*a(n-6) - a(n-7) - 96, for n > 13.
MATHEMATICA
LinearRecurrence[{0, 0, 1, 0, 0, 1, 0, 0, -1}, {1, 3, 7, 5, 10, 8, 14, 16, 11, 20, 22, 13, 26, 28, 17}, 100] (* Paolo Xausa, Jan 23 2025 *)
PROG
(PARI) a(n) = {my(v = [1, 3, 7, 5, 10, 8]); if(n < 7, v[n], n*(1+min(1, n%3))+(n%3 == 0)+(n%6 == 3))}
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas Scheuerle, Dec 01 2022
STATUS
approved