CT060

Nth Sevenish Number

MediumAcceptance: 0.0%

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:

Input: 1
Output: 1

Example 2:

Input: 3
Output: 8

Constraints:

1 <= n <= 1000

Tags:

bit-manipulation math
Loading...
Test Cases:No test cases
No test cases available.