OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
FORMULA
a(n) = n - 1 + ceiling((n^2 - 1)/3).
a(n) = floor((2*n^2 + 6*n - 5)/6) for n > 1. - Sela Fried, Jul 12 2022
G.f.: x*(1 + 2*x^2 - x^3 + x^4 - x^5)/((1 - x)^3*(1 + x + x^2)). - Stefano Spezia, Jul 12 2022
MATHEMATICA
a=3; b=1;
Table[n+Floor[(a*n+b)^(1/2)], {n, 90}]
Table[n-1+Ceiling[(n*n-b)/a], {n, 70}]
LinearRecurrence[{2, -1, 1, -2, 1}, {1, 2, 5, 8, 12, 17}, 70] (* Harvey P. Dale, Jul 01 2015 *)
PROG
(PARI) a(n) = if (n==1, 1, n - 1 + ceil((n^2 - 1)/3)); \\ Michel Marcus, Jul 13 2022
(PARI) a(n)=if(n==1, 1, n^2\3+n-1) \\ Charles R Greathouse IV, Jul 13 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jan 07 2011
EXTENSIONS
Name corrected by Michel Marcus, Jul 13 2022
STATUS
approved