Long ago, I worked with a programmer who had a habit of referring to certain values as “interesting.” What was an interesting number to him? 43,690. Yeah, it seems dull, but in hex it’s
0xAAAA and in binary it’s
Mathematicians have a slate of numbers they find interesting. Most of the fascinating ones are assigned to letters such as π, e, and φ. Mercifully, this Exercise isn’t about those numbers.
For a typical human, an interesting number might be 777 — especially if you’re in Las Vegas. The number itself isn’t particularly useful nor does it harbor any mathematical curiosities. It’s just three repetitive digits.
Your task for this month’s Exercise is to write code that plucks out all the triple-digit “interesting” values from 100 through 1000. Specifically, these values: 111, 222, 333, 444, 555, 666, 777, 888, 999.
I can imagine several ways to accomplish this task, one of which doesn’t use math at all!
Click here to compare my solutions with your own.