Skip to content

ThueMorseNumbers ​

The Thue–Morse sequence 0,1,1,0,1,0,0,1,…0, 1, 1, 0, 1, 0, 0, 1, … as a lazy indexed collection.

ThueMorseNumberst(n)=popcount(n) mod 2t(n) = popcount(n) \bmod 2, an infinite indexed collection.

Domain: Collections

Details
  • A lazy indexed collection: Count(ThueMorseNumbers)=+∞Count(ThueMorseNumbers) = +\infty, and At(ThueMorseNumbers,1)=t(0)=0At(ThueMorseNumbers, 1) = t(0) = 0.
  • OEIS A010060, starting exactly at its offset-0 term: 0,1,1,0,1,0,0,1,1,0,…0, 1, 1, 0, 1, 0, 0, 1, 1, 0, ….
  • Not monotone; every term is 00 or 11, so membership is exactly {0,1}\{0, 1\} -- Element(0,ThueMorseNumbers)Element(0, ThueMorseNumbers) and Element(1,ThueMorseNumbers)Element(1, ThueMorseNumbers) are true, everything else (including 22) is false.

Definition

Epsil, as the implementation runs it.

count()

PositiveInfinity

unrank(_r)

Fold(Function(
               [(bt_s[1] - bt_s[1] % 2) / 2, (bt_s[2] + bt_s[1] % 2) % 2],
               bt_s,
               bt_b,
             ), [_r, 0], Range(1, Floor(Log(_r + 1, 2)) + 2, 1))[2]

rank(_x)

_x if _x == 0 || _x == 1 else -1

valid(_x)

_x == 0 || _x == 1

Enumeration

Examples

1 more kept as data, checked against the oracles
Basic #

The first 20 terms, OEIS A010060

live ↗
InTake(ThueMorseNumbers,20)\mathrm{Take}(\mathrm{ThueMorseNumbers}, 20)Out[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1]\bigl\lbrack0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1\bigr\rbrack
About
Examples2
CrosswalkOEISSageMath

See also: Count, At, Element, SternDiatomicSequence