Project Euler 162 - Hexadecimal Num

Official link: https://projecteuler.net/problem=162

Thought Process

This problem seems like a straightforward inclusion-exclusion principle type of problem

I skip some of the calculations here, but now we have a closed form for the number of strings of length n where 0, 1, A are present at least once, now we just sum all strings of length 3 to 16 and we're done

Interactive Code

Enter a number (yourinput)

Code will output the number hexadecimal numbers containing at most yourinput hexadecimal digits, with all of the digits 0,1, and A present at least once