OFFSET
0,3
COMMENTS
This sequence is "Fibonacci-regular"; there are vectors v, w and matrices M0, M1 (dimension 19) such that a(n) = v M_{a_1} ... M_{a_k} w if a_1 ... a_k is the Fibonacci representation of n. This allows efficient computation of a(n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..17711
Zuzana Masáková and Élise Vandomme, Redundance in the Signed m-Bonacci Numeration System, J. Integer Sequences 24 (2021), Article 21.7.2.
EXAMPLE
For n = 5 the 4 representations are 5, 3+2, 3+2*1, 2*2+1.
MAPLE
h:= proc(n) option remember; `if`((t->
issqr(t+4) or issqr(t-4))(5*n^2), n, h(n-1))
end:
b:= proc(n, i) option remember; `if`(n=0 or i=1, `if`(n<3, 1, 0),
add(b(n-i*j, h(min(n-i*j, i-1))), j=0..min(2, n/i)))
end:
a:= n-> b(n, h(n)):
seq(a(n), n=0..100); # Alois P. Heinz, Jun 04 2021
MATHEMATICA
h[n_] := h[n] = If[IntegerQ@Sqrt[#+4] || IntegerQ@Sqrt[#-4]&[5*n^2], n, h[n-1]];
b[n_, i_] := b[n, i] = If[n == 0 || i == 1, If[n < 3, 1, 0], Sum[b[n-i*j, h[Min[n-i*j, i-1]]], {j, 0, Min[2, n/i]}]];
a[n_] := b[n, h[n]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Sep 08 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Jun 04 2021
STATUS
approved