Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I've same problem with irrational bases,because it isn't quite simaliar with converting from decimal to binary through remainder...it confuses me for a long time...
It puzzles me why you would downvote someone who is offering (or trying to offer) you a service for free, no matter how little you might appreciate it, but ok: different perspective, I would say.
Your last approach seems to make more sense and might work well with irrational bases, then
Okey, I got your point. The logic we apply to intger bases will not work for PI. (i feel my CS101 was lie.. lol)
I'm developing another logic based on your first comment. Will increase powers of PI till just below the number to convert.
Kind of greedy approach? Anyway thanks.. -ve votes taken back.
I mentioned the above formula=>your formula.
But, anyway, apparently keeping up this conversation only brings downvotes, so I think I will pass further development :)
You did not suggested any formula. I know that my logic does not work, thats why wanted to know the correct logic.
I am not sure what is your problem now, but did you try to expand the above formula as I suggest? How much does
Math.PI*Math.PI+3
compute to?I fear the logic you are trying to apply does not work well without integers.
I am sorry for not understanding. I know that any number raised to power 0 returns 1.
But, I will try to explain my doubt:
Lets say, we want to convert 13(in base 10) into binary. Then, 13/2=6 with remainder 1. Hence last digit in binary form will be 1.
Similarly, in base PI, 13/PI = 4 with remainder 0.43364. So, why last digit in base PI is 3? When it should be 0 according to my calculation.
Try to develop and consider that each number raised to the 0th power (ok, but 0 itself) returns 1.
Cheers :)
I did not understand the following test case: converter(13) #returns '103'
13 (in base 10) = 103 (in base PI)
=> 1PI^2 + 0PI^1 + 3*PI^0
My question is: why if 13/3.14159 = 4.13803.
Why did the value unit place value(in 103) was chosen as 3 if remainder is 0.13803 from above.
Kindly help, I am not getting the logic to convert to Base PI.
Got your point, Thanks. Now, I am wondering why do they complicate in books and try to backtrack along the diagonal which is so complex to implement.
I did not get the backtracking loop. I followed the WiKi, started from the bottom right. THe process moved up or sidewas as much as possible. Only when this was not possible, it moved diagonal and checked if value decrement. Thus, tougher one.
Your is so simple. Can you please shed some light on it?
I am getting the same. Expected 50, Got: 51
Any clues on this? Is this a faulty test case. I am using Java.
Update -- Solved, it was my wrong.