A "sevenish" number is one which is either a power of 7, or the sum of unique powers of 7. The first few are 1, 7, 8, 49, 50, 56, 57, ... Given n, find the nth sevenish number (1-indexed).
Example 1:
Example 2:
Constraints:
1 <= n <= 1000
Tags: