OFFSET
0,3
COMMENTS
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..5000
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(0)=1, a(1)=1, a(2)=2, a(n)=n+2.
From Chai Wah Wu, Jul 28 2022: (Start)
a(n) = 2*a(n-1) - a(n-2) for n > 4.
G.f.: (1 - x + x^2 + 2*x^3 - 2*x^4)/(1 - x)^2. (End)
From G. C. Greubel, Dec 26 2025: (Start)
a(n) = n+2 - [n=0] - 2*[n=1] - 2*[n=2].
E.g.f.: (2 + x)*exp(x) - (1 + x)^2. (End)
MATHEMATICA
Join[{1, 1, 2}, Range[5, 100]] (* G. C. Greubel, Dec 26 2025 *)
PROG
(PARI) a(n)=if(n>2, n+2, 1) \\ Charles R Greathouse IV, Jun 20 2024
(Magma) A057544:= func< n| n le 2 select Floor((n+2)/2) else n+2 >; // G. C. Greubel, Dec 26 2025
(SageMath)
def A057544(n): return ((n+2)//2) if n<3 else n+2 # G. C. Greubel, Dec 26 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Antti Karttunen, Sep 07 2000
EXTENSIONS
More terms from Sean A. Irvine, Jun 13 2022
STATUS
approved
