Try now in the
Open Cloud »
(no sign-in required)

Find Your Birthday in Pi

Find where in the digits of Pi the digits of your birthday occur.

Run the code to get the first 1,000 digits of Pi. Try more digits:

SHOW/HIDE DETAILS

Get a list of the first 20 digits of Pi in base 10, plus the number of digits to the left of the decimal point:

In[1]:=
X
Out[1]=

Get just the list of digits:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Find where your birthday occurs in the digits of Pi. Try other sequences of digits:

Note: increase the number of digits of Pi until you find your sequence; e.g. try 10 times more digits each time.


Note: sequences of digits longer than 6 may require a very long time to compute.

SHOW/HIDE DETAILS

Make a list of the digits of your birthdayfor example, for November 17, 1999:

In[1]:=
X
Out[1]=

Find the position of that sequence in the digits of Pi:

In[2]:=
X
Out[2]=

The pairs of numbers are the positions in the digits of Pi of the first and last digits of the sequence. If the sequence occurs more than once, youll get more than one pair. If the sequence doesnt occur at all, youll get the empty list {}.

Increase the number of digits of Pi if your sequence is not found. For example, try 10 times more digits.

HIDE DETAILS
In[1]:=
X
Out[1]=

Print the digits of Pi, ending at the first occurrence of your birthday:

SHOW/HIDE DETAILS

Find the position of your birthday in the digits of Pi. Increase the number of digits, if necessary, to find the sequence:

In[1]:=
X
Out[1]=

The end of the first occurrence of the sequence is 49,707. Get the first 49,707 digits of Pi and give it the name digits:

In[2]:=
X

49,707 digits are way too many to print, so instead make an abbreviated form.

This gives the first 100 digits:

In[3]:=
X
Out[3]=

This gives the last 100 digits (-1 means the last digit, -100 means the 100th-from-last digit):

In[4]:=
X
Out[4]=

Row formats a list of objects without the braces, commas, and quotation marksfor example:

In[5]:=
X
Out[5]=

Use Row to show the first 100 digits, an ellipsis (...), and the last 100 digits. Flatten flattens out the sublists of digits:

In[6]:=
X
Out[6]=

Restore the decimal point by omitting the first digit and supplying the missing 3 and decimal point explicitly:

In[7]:=
X
Out[7]=

This code is essentially what was implemented to make the Wolfram My Pi Day site.

HIDE DETAILS
In[1]:=
X
Out[1]=