Question 9
Exercise 9. The numbers from 1 to 2017 are listed in the following order: first all numbers not divisible by 3 are listed in increasing order. Then all numbers divisible by 3 but not by $3^2$ are listed in increasing order. Then all numbers divisible by $3^2$ but not by $3^3$ are listed in increasing order, and so on. What is the last number on this list? (Give the entire number, not just its last digit.)