cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A364754 Smallest nonnegative integer not expressible by the addition and subtraction of fewer than n Lucas numbers.

Original entry on oeis.org

0, 1, 5, 23, 99, 421, 1785, 7563, 32039, 135721, 574925, 2435423, 10316619, 43701901, 185124225, 784198803, 3321919439, 14071876561, 59609425685, 252509579303, 1069647742899, 4531100550901, 19194049946505, 81307300336923, 344423251294199, 1459000305513721, 6180424473349085
Offset: 0

Views

Author

Mike Speciner, Oct 20 2023

Keywords

Examples

			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.
		

Crossrefs

Cf. A000032, A004146 (adding positive Lucas numbers), A365907 (adding any Lucas numbers).
Cf. A001076 (with Fibonacci numbers).

Programs

  • Mathematica
    a[n_] := (LucasL[3*n - 1] - 1)/2; a[0] = 0; Array[a, 27, 0] (* Amiram Eldar, Oct 21 2023 *)
  • Python
    from sympy import lucas
    a = lambda n: n and (lucas(3*n-1)-1)//2

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

A367816 Number of terms in a shortest sequence of Lucas numbers that sum to n, allowing Lucas numbers with negative indices.

Original entry on oeis.org

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
Offset: 0

Views

Author

Mike Speciner, Dec 01 2023

Keywords

Examples

			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.
		

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.

Programs

  • 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];

Formula

a(0) = 0; a(A000032(n)) = 1.
For n > 0, a(n) = 1+min(a(n-Lucas(k))) where k ranges over Z.
Showing 1-2 of 2 results.