Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to determine base of a number?

Given a integer number and its reresentation in some arbitrary number system. The purpose is to find the base of the number system. For example, number is 10 and representation is 000010, then the base should be 10. Another example: number 21 representation is 0010101 then base is 2. One more example is: number is 6 and representation os 10100 then base is sqrt(2). Does anyone have any idea how to solve such problem?

like image 624
evil.coder Avatar asked Apr 08 '10 13:04

evil.coder


1 Answers

         ___
         \
number = /__ ( digit[i] * base ^ i )

You know number, you know all digit[i], you just have to find out base.

Whether solving this equation is simple or complex is left as an exercise.

like image 163
mouviciel Avatar answered Sep 18 '22 16:09

mouviciel