Given a range of hexadecimal numbers, how do I determine the total number of them that do not look like decimal numbers?
Background: I'm designing a system that auto-generates IDs that consist of four digit hexadecimal numbers but I want to exclude those that looks like decimal numbers so that users are not confused. I only want to know that with that restriction, how many IDs can the system generate (and decide if I need to increase the number of digits or not).
N.B. I can easily detect if a hexadecimal number looks like a decimal number or not though.
Number of numbers with at least an hex letter (
atof) as Travis commented $$16^{n} - 10^{n} = 55536$$Number of numbers with no decimal at all (
atofonly) $$6^{n} = 1296$$Number of numbers with at least an hex letter (
atof) with no leading zero $$16^{n} - 10^{n} - 16^{n-1} + 10^{n-1} = 52440$$