Find out base of the following arithmetic operation.
So for example 41/3=13 is true in base 8.
Another example: 23+44+14+32=223 is true in base 5.
You are given a string with an arithmetic equation. Return the base.
is the last one rounded?? should be 12.121??
J.R. I believe that 4 is correct. It translates to 50/8, which is 6.25 in base 10. In base 4, that equals 12.1, as the number behind the decimal is 1/4.
However, I think #3 should be '41^0.3=5', since (presumably) you're trying to take the square root of 41. In base 6, 0.5 is 5/6, and 25^(5/6) is not a rational number in any base.
Please correct me if I'm wrong on this, as it's been a while since I've dealt with base 6 decimals. :-)
J.R.! Menzinger.. No, it is 12.1 only.
James, I will correct , it is 41^0.5
#3 , assume base is b. and convert to decimal and square on both sides and you will get correct base system.
Ok! I understand... ;-)
The hint: use rationals.
Pritesh, I sent an e-mail with some further questions, as the formatting in the comments section would make it unreadable.
James, Done... Also, added new test case, which is suggested by you...
Glad I could help. Now I just need to solve the problem! :-)
times 10 is nice!
yes, your solution is good..
did you like my solution, isn't it?? ;-)
Since all the cool kids are submitting this one, I thought I'd join the fun. :-)
High school cafeteria
Back to basics 15 - classes
Replicate elements in vectors
Max index of 3D array
matlab indian players
Find out sum of prime number till given number
Find out value of sine given by degree.
Add two different item as shown in example
Try and Catch Simple Example
Union of two set decreasing order
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office