A number system consist only 3 and 4. Find the Nth number of the number system. write a function findNthdigit( N) which returns the Nth number of the number system
Can anybody solve this using python??
Answers
Answered by
15
Answer:
The number system is similar to the binary number system but the number 0 is replaced by 3 and number 1 is replaced by 4.
Let’s say this as sBinary.
So, number Nth number is (n-1)’s Sbinary conversion.
With this knowledge, we can easily solve the problem by finding the binary equivalent of (N-1) and then adding each digit of the binary number found by 3.
How to Convert Decimal to Binary?
Similar questions