- Given an integer n, find and return the n’th magic number
- A magic number is defined as a number which can be expressed as a power of 7 or sum of unique powers of 7
- First four magic numbers are 7 , 49 , 56 (7 + 49), 343,etc .

i have implemented the solution as follows:

https://ideone.com/Q8OM0b

but it gives me wrong answer,the only difference is that when calculating the value of add we need to apply mod;and the correct solution is as follows:

how will we know where to apply a mod operator…pls help.