login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A367816 Number of terms in a shortest sequence of Lucas numbers that sum to n, allowing Lucas numbers with negative indices. 1
0, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 2, 3, 3, 2, 3, 3, 2, 1, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 1, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 3, 2, 3, 3, 3, 3, 4, 3, 2, 3, 3, 2, 1, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
LINKS
FORMULA
a(0) = 0; a(A000032(n)) = 1.
For n > 0, a(n) = 1+min(a(n-Lucas(k))) where k ranges over Z.
EXAMPLE
For n = 0, the empty sequence sums to 0, so a(0) = 0.
For n = 1, 2, 3, 4, 7, 11, 18, each n is a Lucas number, so a(n) = 1.
The first n needing a negative-index Lucas number is 17 = 18 + -1; a(17) = 2.
PROG
(Python)
from itertools import count
def a(n) :
"""For integer n, the least number of Lucas terms required to sum to n."""
f = [2, 1]; # Lucas numbers, starting with Lucas(0)
while f[-1] <= (n or 1) :
f.append(f[-2]+f[-1]);
a = [0 for _ in range(f[-1]+1)];
for i in f :
a[i] = 1;
for c in count(2) :
if not all(a[4:]) :
for i in range(4, f[-1]) :
if not a[i] :
for j in f :
if j >= i :
break;
if a[i-j] == c-1 :
a[i] = c;
break;
if not a[i]:
for j in f[1::2] :
if i+j >= len(a) :
break;
if a[i+j] == c-1 :
a[i] = c;
break;
else :
break;
return a[n];
CROSSREFS
Cf. A000032 Lucas numbers; A061084 negative index Lucas numbers.
A116543 is the similar sequence where negative index Lucas numbers are not allowed.
a(A365907(n)) is the first occurrence of n.
Sequence in context: A037196 A368594 A169818 * A116543 A256911 A347562
KEYWORD
nonn,easy
AUTHOR
Mike Speciner, Dec 01 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 11 17:12 EDT 2024. Contains 374234 sequences. (Running on oeis4.)