The approach to use here is to start with 00000000 and then "fix" it iteratively. 00000000 becomes 10000008 since there were 8 0s and only 1 digit in use but now there are 6 0s and a 1 and an 8 and 3 digits in use, so update it to be 30000016 of course now there are only 5 0s and a 1 and a 3 and a 6, which means that there are 4 digits in use, so update it to be 41001015 just keep iterating until you hit a steady state...