OFFSET
0,3
COMMENTS
Also, numbers congruent to {0, 1, 4, 8, 11, 12} mod 18.
First differences: 1, 3, 4 or 6.
a(h) + a(h+1) is in the sequence if h is not of the form 3*k+1 (A007494). In this case: a(h) + a(h+1) = a(2*h+1).
LINKS
Bruno Berselli, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,1,1,0,-1).
FORMULA
G.f.: x*(1 + 4*x + 7*x^2 + 6*x^3)/((1 - x)^2*(1 + 2*x + 2*x^2 + x^3)).
a(n) = a(n-2) + a(n-3) - a(n-5).
a(n) = 3*n - (n mod 2) - (n mod 3). More generally, it is easy to see that Sum_{i=1}^k i*floor(n/i) = k*n - Sum_{i=1}^k (n mod i).
a(3*m + r) = 9*m + r^2 - (1-(-1)^m)*(-1)^r/2, with r = 0, 1 or 2. Therefore: for even m, a(3*m + r) = 9*m + r^2; otherwise, a(3*m + r) = 9*m + r^2 - (-1)^r.
MATHEMATICA
Table[n + 2*Floor[n/2] + 3*Floor[n/3], {n, 0, 70}]
PROG
(PARI) vector(70, n, n--; n+2*floor(n/2)+3*floor(n/3))
(Sage) [n+2*floor(n/2)+3*floor(n/3) for n in (0..70)]
(Maxima) makelist(n+2*floor(n/2)+3*floor(n/3), n, 0, 70);
(Magma) [n+2*Floor(n/2)+3*Floor(n/3): n in [0..70]];
(Python)
def A272299(n): return n+(n&-2)+3*(n//3) # Chai Wah Wu, Jan 18 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Apr 30 2016
STATUS
approved