Do all calculations in base B2.
All you need is the addition and multiplication in base B2 (add_b2() and mul_b2()). Then simply calculate An*B1^n+An-1*B1^(n-1)+...+A1*B1+A0 (X=AnAn-1...A1A0 in base B1) in base B2.

For add_b2() and mul_b2(), if you have done high precision addition/multiplication before, just replace base 10/10000/... with base B2.

On 2010-8-18 0:20, luckyzoner wrote:
I had proposed an algorithm of repeatedly subtracting 1 from the given
number and subsequently adding 1 to the new number initialised to 0,
till the given number becomes 0. However as soon as the digit reaches
the limit , the digit becomes 0 and you add 1 to the next digit. I was
not able to code it properly as i had to use int data type only. It
would have been easy if the array of integers was allowed to use.

Pls suggest the code for the same or some better algo.

Thanx
Lakshaya


--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to