OFFSET
0,5
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
EXAMPLE
n a(n) A352103(n)
- ---- ----------
0 1 0
1 0 1
2 1 10
3 0 11
4 2 100
5 1 101
6 1 110
7 0 111
8 2 1001
9 2 1010
MATHEMATICA
t[1] = 1; t[2] = 2; t[3] = 4; t[n_] := t[n] = t[n - 1] + t[n - 2] + t[n - 3]; trib[n_] := Module[{s = {}, m = n, k}, While[m > 0, k = 1; While[t[k] <= m, k++]; k--; AppendTo[s, k]; m -= t[k]; k = 1]; IntegerDigits[Total[2^(s - 1)], 2]]; a[n_] := Module[{v = trib[n]}, nv = Length[v]; i = 1; While[i <= nv - 3, If[v[[i ;; i + 3]] == {1, 0, 0, 0}, v[[i ;; i + 3]] = {0, 1, 1, 1}; If[i > 3, i -= 4]]; i++]; i = Position[v, _?(# > 0 &)]; If[i == {}, 1, Count[v[[i[[1, 1]] ;; -1]], 0]]]; Array[a, 100, 0]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amiram Eldar, Sep 03 2022
STATUS
approved