[edit] ChallengeGiven a number x and the number of places from the right i, find the digit at the ith place. If i = 0, then find the number in the "ones" column. [edit] BackgroundThis problem actually came from needing to convert a number from binary to decimal. Isolating a digit was a key part of the equation. The formula I found will work for isolating a digit of any number, not just binary numbers. The general concept goes like this: Remove numbers to the right of the number in the ith place and remove numbers to the left of the digit in the ith place. In the following example, we will refer to the digit in the ith place as the target digit. [edit] ExampleIn this example we will use x = 52,849 and attempt to isolate the number 8. That number is in the 100’s place so i = 2. |