This has probably already been done before, but I had lots of fun discovering it. :)
I wanted to create a function , which, given a number , would take in the place value of a digit of (, such that the place value of is ), and output itself.
For example, if , than , , and .
Here's what I came up with:
And a Desmos graph.
I came up with it somewhat inductively, noting patterns while calculating the units digit, the tens digit, and so on, but I understand now why it works. The function essentially chops off everything after the desired place value, subtracts from that everything before the desired place value, and then divides by the power of ten associated with that place value. For example:
, (should retrieve the digit at , or )