I wrote one of these a few years back: https://stackoverflow.com/questions/18947892/creating-range-... - honestly I hate this sort of cleverness in real code but it makes for interesting puzzles.
(As long as no one actually asks these questions in interviews)