Lesson goal: Finding patterns in Pi (more)

Previous: Patterns in Pi ($\pi$) | Home | Next: Introduction

In a past lesson we defined variable bigpi to be the first 10,000 digits of $\pi$. We then used this to look for digits occurrence in $\pi$.

Here's another lesson that maps each digit of $\pi$ into a letter using the mapping that 0=A, 1=B, 2=C, ... 26=Z. We've provided a function here called tonum which will convert a search string of interest into a series of digits. So for example, tonum("hi") would return 78, since "h" is the 7th digits in the alphabet (starting with 0=A), and "i" is the 8th. So searching for "hi" in $\pi$ would mean to search for the digits "78." Make sense?

In this lesson, you can search for such word-codes in $\pi$ using the built in string search function called string.find.
string.find(haystack,needle)
Move the mouse over a dotted box for more information.

Now you try. Fix the the string.find line to search for num within bigpi.

Type your code here:


See your results here: