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

Pi Digit Necklaces

Make a necklace where the size of each bead is determined by a digit of π.

Run the code to get the first 100 digits of π in base 10. Try finding more than 100 digits:

SHOW/HIDE DETAILS

This gives a list of the first 8 digits of π in base 10, followed by the number of digits to the left of the decimal point:

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

Use First if you want just the list of digits:

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

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

Write out the digits with their size proportional to their values. Try scaling factors other than 10for example, 5:

Note: the scaling factor is the first occurrence of 10.

SHOW/HIDE DETAILS

This writes the digit 5 in a 50-point font (a point is a printers measure equal to 1/72 inch):

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

This writes the digits from 1 to 5 in font sizes proportional to their values:

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

A more efficient way to write the same thing uses a pure function. This is a pure function that adds 3 to a number:

In[3]:=
X

Use it to add 3 to 5:

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

Use the pure function to add 3 to every element of a list:

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

You can apply styles with pure functions. This makes the font size of each digit proportional to its value. Its the same result that you saw before:

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

Use Row to turn the list into a row of digits without braces or commas:

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

Do the same thing with the first 100 digits of π :

In[8]:=
X
Out[8]=

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

Use disks instead of actual digits. Try other shapes, like (\[FilledSquare ]) or (\[FilledDiamond ]):

SHOW/HIDE DETAILS

Type \[FilledCircle ] to get a disk character:

In[1]:=
X

Make a large disk:

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

Make disks whose sizes are proportional to the digits of π :

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

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

Pick a random color for each disk:

SHOW/HIDE DETAILS

RandomColor gives a different color each time its run. Try running it several times:

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

Make a 100-point disk with a random color:

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

Make randomly colored disks sized according to the digits of π :

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

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

Make a necklace of disks:

SHOW/HIDE DETAILS

Put a Pane around each disk to make the disks line up. A Pane is an invisible container that takes on the height of the row and the width of its contents. The disks are centered vertically within the panes, which makes them align on their centers:

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

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

Share ItMake a digit necklace website:

SHOW/HIDE DETAILS

Deploy a form makes a digit necklace with the starting digit and number of digits you specify:

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

Click the link in the output to visit the site.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

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