44
4
In many fonts (specifically in the Consolas font), 5 out of the 10 decimal digits have "holes" in them. We will call these holy digits:
46890
The 5 unholy digits are thus:
12357
An integer may thus be classified as "holy" if it only contains holy digits, and "unholy" otherwise. Because - is unholy, no negative integers can be holy.
Holy integers may be further classified based on how many holes they have. For example, the following digits have a holiness of 1:
469
And these digits have a holiness of 2:
80
We say that the overall holiness of an integer is the sum of the holiness of its digits. Therefore, 80 would have a holiness of 4, and 99 would have a holiness of 2.
The Challenge
Given two integers n > 0 and h > 0, output the nth holy integer whose holiness is at least h. You may assume that the inputs and outputs will be no greater than the maximum representable integer in your language or 2^64 - 1, whichever is less.
Here is a list of the first 25 holy integers with holiness h >= 1, for reference:
0, 4, 6, 8, 9, 40, 44, 46, 48, 49, 60, 64, 66, 68, 69, 80, 84, 86, 88, 89, 90, 94, 96, 98, 99
The first 25 holy integers with holiness h >= 2 are:
0, 8, 40, 44, 46, 48, 49, 60, 64, 66, 68, 69, 80, 84, 86, 88, 89, 90, 94, 96, 98, 99, 400, 404, 406
Related - 1 2
– Mego – 2016-02-17T20:23:03.36326i was sitting here for like thirty seconds thinking "how the heck does
0have a holiness of two" before i finally clicked on the wikipedia link to Consolas – undergroundmonorail – 2016-02-17T21:20:02.667Is the fifth 1-Holy number 9 or 40? – Conor O'Brien – 2016-02-17T22:54:06.090
@CᴏɴᴏʀO'Bʀɪᴇɴ 9. It's the fifth number in the list, at index 4 (starting from 0, of course). – Mego – 2016-02-17T22:55:02.093
Ah, okay. Wasn't sure if "n"th referred to index or ordinal. Thanks! – Conor O'Brien – 2016-02-17T22:55:30.730
Related 3 http://codegolf.stackexchange.com/q/51877/31716
– James – 2016-02-18T02:53:54.0803Is it just coincidence that the 8th 8+-holy number is 8888? (yes, it probably is, but it amused me anyway...) – Toby Speight – 2016-02-18T16:34:22.963
5In fact, since you can have any number of leading 0's before a number, one could make the case that 0 is infinitely holy. Although ∞ is apparently just as holy. But strangely, 666 is even holier... – Darrel Hoffman – 2016-02-18T16:47:15.933