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.

A356898 a(n) is the number of trailing 1's in the maximal tribonacci representation of n (A352103).

Original entry on oeis.org

0, 1, 0, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 4, 0, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 4, 0, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 6, 1, 0, 2, 0, 1, 0, 4, 0, 2, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 3, 1, 0, 2, 0, 1, 0, 4, 0, 2, 0, 1
Offset: 0

Views

Author

Amiram Eldar, Sep 03 2022

Keywords

Comments

The asymptotic density of the occurrences of k = 0, 1, 2, ... is (c-1)/c^(k+1), where c = 1.839286... (A058265) is the tribonacci constant.
The asymptotic mean of this sequence is 1/(c-1) = 1.191487...

Examples

			  n  a(n)  A352103(n)
  -  ----  ----------
  0     0           0
  1     1           1
  2     0          10
  3     2          11
  4     0         100
  5     1         101
  6     0         110
  7     3         111
  8     1        1001
  9     0        1010
		

Crossrefs

Similar sequences: A278045, A356749.

Programs

  • 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]]; f[v_] := Module[{m = Length[v], k}, k = m; While[v[[k]] == 1, k--]; m - k]; 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 == {}, 0, f[v[[i[[1, 1]] ;; -1]]], 10]]; Array[a, 100, 0]