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.

A135818 Number of 1's (or A's) in the Wythoff representation of n.

Original entry on oeis.org

1, 0, 1, 2, 0, 3, 1, 1, 4, 2, 2, 2, 0, 5, 3, 3, 3, 1, 3, 1, 1, 6, 4, 4, 4, 2, 4, 2, 2, 4, 2, 2, 2, 0, 7, 5, 5, 5, 3, 5, 3, 3, 5, 3, 3, 3, 1, 5, 3, 3, 3, 1, 3, 1, 1, 8, 6, 6, 6, 4, 6, 4, 4, 6, 4, 4, 4, 2, 6, 4, 4, 4, 2, 4, 2, 2, 6, 4, 4, 4, 2, 4, 2, 2, 4, 2, 2, 2, 0, 9, 7, 7, 7, 5, 7, 5, 5, 7, 5, 5, 5, 3, 7, 5, 5
Offset: 1

Views

Author

Wolfdieter Lang, Jan 21 2008

Keywords

Comments

a(n) = number of applications of Wythoff's A sequence A000201 needed in the unique Wythoff representation of n>=1.
See A135817 for references and links for the Wythoff representation for n>=1.

Examples

			6 = A(A(A(B(1)))) = AAAB = `1110`, hence a(6)=3.
		

Crossrefs

Cf. A000201, A135817 (lengths of Wythoff representation), A007895 (number of 0's (or B's) in the Wythoff representation).

Programs

  • Mathematica
    z[n_] := Floor[(n + 1)*GoldenRatio] - n - 1; h[n_] := z[n] - z[n - 1]; w[n_] := Module[{m = n, zm = 0, hm, s = {}}, While[zm != 1, hm = h[m]; AppendTo[s, hm]; If[hm == 1, zm = z[m], zm = z[z[m]]]; m = zm]; s]; w[0] = 0; a[n_] := Total[w[n]]; Array[a, 100] (* Amiram Eldar, Jul 01 2023 *)