Skip to content

Instantly share code, notes, and snippets.

@arnaud
Created November 13, 2022 00:15
Show Gist options
  • Save arnaud/ae4b5e2c6bb412fb8a274862dd1ab234 to your computer and use it in GitHub Desktop.
Save arnaud/ae4b5e2c6bb412fb8a274862dd1ab234 to your computer and use it in GitHub Desktop.
Thue-Morse sequence in JavaScript
[...Array(8)].reduce(a=>[...a,...a.map(i=>+!i)],[0])
// => 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0…
@arnaud
Copy link
Author

arnaud commented Nov 13, 2022

In reference to https://oeis.org/A010060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment