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:
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:
Use First if you want just the list of digits:
Write out the digits with their sizes proportional to their values. Try scaling factors other than 10—for example, 5:
Note: the scaling factor is the first occurrence of 10.
This writes the digit 5 in a 50-point font (a “point” is a printer’s measure equal to 1/72 inch):
This writes the digits from 1 to 5 in font sizes proportional to their values:
A more efficient way to write the same thing uses a pure function. This is a pure function that adds 3 to a number:
Use it to add 3 to 5:
Use the pure function to add 3 to every element of a list:
You can apply styles with pure functions. This makes the font size of each digit proportional to its value. It’s the same result that you saw before:
Use Row to turn the list into a row of digits without braces or commas:
Do the same thing with the first 100 digits of π :
Use disks instead of actual digits. Try other shapes, like ■ (\[FilledSquare ]) or ◆ (\[FilledDiamond ]):
Type \[FilledCircle ] to get a disk character:
Make a large disk:
Make disks whose sizes are proportional to the digits of π :
Pick a random color for each disk:
RandomColor gives a different color each time it’s run. Try running it several times:
Make a 100-point disk with a random color:
Make randomly colored disks sized according to the digits of π :
Make a “necklace” of disks:
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:
Share It—make a digit necklace website:
Deploy a form that makes a digit necklace with the starting digit and number of digits you specify:
Click the link in the output to visit the site.
Tell the world about your creation by sharing the link via email, tweet or other message.