OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (5,-3,-1).
FORMULA
a(0) = 0.
a(n) = (A000032(3*n-1)-1)/2, for n > 0.
a(n) = 1 + Sum_{i=1..n-1} A000032(3*i), for n > 0.
G.f.: x*(1 + x^2)/((1 - x)*(1 - 4*x - x^2)). - Stefano Spezia, Oct 21 2023
EXAMPLE
a(0) = 0, since 0 is expressible as the sum of 0 Lucas numbers.
a(1) = 1, since 1 is a Lucas number.
a(2) = 5, since 2, 3, and 4 are all Lucas numbers; while 5=1+4, the sum of 2 Lucas numbers.
a(3) = 23, since integers less than 23 are expressible with 2 or fewer Lucas numbers, while 23 = 1+4+18 requires 3 terms.
MATHEMATICA
a[n_] := (LucasL[3*n - 1] - 1)/2; a[0] = 0; Array[a, 27, 0] (* Amiram Eldar, Oct 21 2023 *)
PROG
(Python)
from sympy import lucas
a = lambda n: n and (lucas(3*n-1)-1)//2
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Mike Speciner, Oct 20 2023
STATUS
approved