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.

A356894 a(n) is the number of 0's in the maximal tribonacci representation of n (A352103).

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Sep 03 2022

Keywords

Examples

			  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
		

Crossrefs

Similar sequences: A023416, A102364, A117479, A278042.

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

Formula

a(n) = A356895(n) - A352104(n).

A360260 a(0) = 0, and for any n > 0, let k > 0 be as small as possible and such that T(3) + ... + T(2+k) >= n (where T(m) denotes A000073(m), the m-th tribonacci number); a(n) = k + a(T(3) + ... + T(2+k) - n).

Original entry on oeis.org

0, 1, 3, 2, 5, 6, 4, 3, 8, 10, 9, 6, 7, 5, 4, 12, 11, 14, 15, 13, 8, 9, 11, 10, 7, 8, 6, 5, 16, 17, 15, 14, 19, 21, 20, 17, 18, 10, 11, 13, 12, 15, 16, 14, 9, 10, 12, 11, 8, 9, 7, 6, 21, 23, 22, 19, 20, 18, 17, 25, 24, 27, 28, 26, 21, 22, 24, 23, 12, 13, 15
Offset: 0

Views

Author

Rémy Sigrist, Jan 31 2023

Keywords

Comments

See A356895 for the corresponding k's.
See A360259 for the Fibonacci variant.

Examples

			The first terms, alongside the corresponding k's, are:
  n   a(n)  k
  --  ----  ---
   0     0  N/A
   1     1    1
   2     3    2
   3     2    2
   4     5    3
   5     6    3
   6     4    3
   7     3    3
   8     8    4
   9    10    4
  10     9    4
  11     6    4
  12     7    4
  13     5    4
  14     4    4
  15    12    5
		

Crossrefs

Programs

  • PARI
    tribonacci(n) = ([0,1,0; 0,0,1; 1,1,1]^n)[2,1]
    { t = k = 0; print1 (0); for (n = 1, #a = vector(70), if (n > t, t += tribonacci(2+k++);); print1 (", "a[n] = k+if (t==n, 0, a[t-n]));); }

Formula

a(A027084(n)) = n - 1.
Showing 1-2 of 2 results.