Saturday, September 30, 2017

Making Turtle pictures with Numbers made from Numbers

The post Random Walks with Number Digits looked at pictures made from the digits of numbers. Go through each digit in turn. If it is 0 take a step to the right. If it is one go 36 degrees down from that. If it is 2 72 degrees etc etc. For base ten numbers this makes a picture that looks like brownian motion but with only 10 directions not any possible direction.

In this post I look at numbers made from numbers.

The Copeland–Erdős constant is made by sticking together all the prime numbers into a number 2 then 3 then 5 then 7 then 11 etc.. 0.235711131719232931374143 A033308. One of these turtle logo pictures made from this number has a very odd pattern. With 1.5 million digits from prime numbers this pattern is made. The Copeland–Erdős constant is normal so I would expect the loop to eventually come back around.

Champernowne constant is made with 1 then 2 then 3 then 4 etc.. 0.12345678910111213141516 makes a similar picture but it is much more curvy. 600k digits looks like

Thursday, September 28, 2017

Random Walks with Number Digits

Say you took each digit of a number and used that to decide which direction to take a step. What path would you follow?

Similar to last post I took Pi, e, Sqrt(2) and random numbers. I multiplied each digit by 36. There are 10 digits to go into the 360 degrees you can go. For 0 step right. For 1 36 degrees down from 0. For 2 72 degrees etc.

Here are the pictures with a description of which number made each at the end. If any look different that might be an indication the digits are not that random.


After drawing this I realised it looked like Dragon Curves. Googling Pi pictures and Golden curves revealed this book. so someone had the idea before.

My code for all these pictures is here. The picture is on reddit and people seemed to like it.

And now other numbers

E first 700k

e next million


Using a random number generator, just for comparison

Catalan Constant

These look like pictures of brownian motion which in effect they are.

Wednesday, September 27, 2017

Pi Digits High Low Game

Suppose you take a long number and for each digit if it is bigger then the previous one increase a counter by one. If it is less then the previous number reduce the counter by one. You keep a running total and graph that total. Noting when it passes 0. This total number will go up and down and can get to zero many times. If you play this game with random numbers in a million digits on average the number of times you will have crossed 0 is 1594.4 and the standard deviation of the number of times crossed 0 is 1207.3. Though as the number of times zero is crossed cannot be less then 0 this is a bit odd.
import random

while j < 200:
	i = 0
	while i < 1000000:
		ran= random.randint(0, 10)
		if ran==last:
		elif ran>last:
		if total==0:
If instead of random numbers the digits of pi are used. This is what the path of total counts looks like
file = open("pi1000000.txt", "r") 
#3.14159265358979323846264338327950 pi2.txt
x = []
y = [] 

pi = list(text)
total =0
i = 0

while i < len(pi):
	if pi[i]>pi[i-1]:
	if pi[i]

Pi has a 0 total 657 times. Which is more than 51 out of 200 random million long sequences did in my tests. None of this means anything. Going up or down based on digits in a base ten number but i like these pattern sort of sequences.

E crosses 0 1725 times

sqrt2 crosses 0 1300 times

and with 2 million digits

The python code for visualisation is 
import numpy as np
import matplotlib.pyplot as plt

plt.scatter(x, y, alpha=0.5, color='green')
plt.title('Sqrt 2 High Low Game')