Sequences Plotted As Square Spirals

0. The Ulam prime spiral takes a square spiral and puts a black pixel at the nth place if n is a prime number.




1. The Thue-Morse sequence can be plotted on the same spiral. It's the iterative fixed point of the morphism (0 → 01, 1 → 10) starting from 0.


2. The binary Fibonacci sequence is the iterative fixed point of the morphism (0 → 01, 1 → 0) starting from 0. Really ugly.


3. Binary integers concatenated, with primes in higher contrast. If you put a radix point after the initial zero, you get C2, the binary Champernowne constant:


4. The dragon curve sequence is the fixed-point of the morphism (11→1101, 01→1001, 10→1100, 00→1000) starting from 11. There are others ways to generate it, e.g. you can start with 1 and keep inserting alternating 0s and 1s between symbols of the string from the last step. Or you can take the string from the last step, add a zero, and then add the reversed complement of the old string. Or other things. 




5. The Lyndon words are bit strings that come strictly lexicographically before all of their cyclic permutations. Here they are presented in order on a spiral:


6. The big omega function in number theory, Ω(n), counts the total number of prime factors of an integer n. Below I use 255 * (1 - 1/ω(n)) as the value for the nth pixel, thereby mapping the range [1, infinity) to [0, 1]. Although values of ω(n) >= 255 actually all get mapped to 254 because of finite precision graphics, so it's more like a map from [1, 255] to [0, 1], but it's also not an issue here because none of the integers represented in this picture have anywhere close to 255 prime factors.


7. The little omega function in number theory, ω(n), counts the number of distinct prime factors of an integer n. It's slightly darker than the image above. For example, in little omega, squares and cubes are black, just like the primes.


8. The Baum-Sweet sequence asks whether there are any blocks of consecutives zeroes of odd length in the binary representation of the nth integer. It's also the fixed point of the morphism (00 → 0000, 01 → 1001, 10 → 0100, 11 → 1101). Here I've drawn its binary complement, because I like black dot son white more than white dots on black.

9. My preferred form of the Rudin-Shapiro sequence counts the number of occurrences of "11", with overlaps allowed, modulo 2, in binary representation of n.

I am not hardly done! There are many more pictures I want to plot and share. I'll probably include a bunch of other morphic and automatic sequences, some things related to roots and transcendental numbers, and then things will just get spicier from there. You'll see. You'll all see.