## In the hexadecimal number system numbers are represented using $16$ different digits:

$$0,1,2,3,4,5,6,7,8,9,\mathrm A,\mathrm B,\mathrm C,\mathrm D,\mathrm E,\mathrm F.$$

The hexadecimal number $\mathrm{AF}$ when written in the decimal number system equals $10 \times 16 + 15 = 175$.

In the $3$-digit hexadecimal numbers $10\mathrm A$, $1\mathrm A0$, $\mathrm A10$, and $\mathrm A01$ the digits $0$, $1$ and $\mathrm A$ are all present.

Like numbers written in base ten we write hexadecimal numbers without leading zeroes.

How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits $0$, $1$, and $\mathrm A$ present at least once?

Give your answer as a hexadecimal number.

(A, B, C, D, E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes, e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F)

### To solve this problem, we can use combinatorics to count the number of possible combinations.

We need to ensure that the digits $0$, $1$, and $\mathrm{A}$ are present at least once in the hexadecimal number. Let’s consider the cases separately:

1. The digit $0$ is present but not $\mathrm{A}$: In this case, we have $15$ choices for each of the remaining $15$ digits. Therefore, the number of combinations is $15^{15}$.

2. The digit $\mathrm{A}$ is present but not $0$: Similarly, we have $15$ choices for each of the remaining $15$ digits. The number of combinations is $15^{15}$.

3. Both the digits $0$ and $\mathrm{A}$ are present: In this case, we have $14$ choices for each of the remaining $14$ digits. The number of combinations is $14^{14}$.

Since these cases are mutually exclusive, we can add up the number of combinations from each case to get the total number of combinations. Therefore, the total number of combinations is $2 \cdot (15^{15}) + 14^{14}$.

Now, we can calculate this value using Python code:

“`python

total_combinations = 2 * (15**15) + 14**14

hex_total_combinations = hex(total_combinations).upper()

print(hex_total_combinations)

“`

The code above calculates the total number of combinations and converts it to a hexadecimal representation using the `hex()` function in Python. The `upper()` method is used to convert the hexadecimal string to uppercase, as specified in the question.

The output of the code will be the hexadecimal representation of the total number of combinations.

##### More Answers:

Digital Root Sums of FactorisationsFactorial Trailing Digits

Triominoes