Consider one digit at a time. If you get a 1 then you have to make sure the next number is not a 7. So if you have 6 digits then you need to check each digit individually with six layers of branches.
First digit is > 1 then go to the next digit. If 1 you can only have 8 possibilities for the next digit instead of 9. You will also have to decide whether you can start with a 0 or not.
Each branch has two choices to consider: you either got a 1 before and need to check for a 7 or you didn't get a 1 and just pick any number. There are 2^5 choices or 32 choices to consider as a tree diagram but you can derive a formula to calculate this (leave the first out because you can always choose a number for first digit).
You should probably show us what you have tried, but if you use a tree diagram you will get 32 different combinations and then you add up the ones where you don't get a 17 in them (you will add up 16 different set of combinations to get the answer).