+ 4

Counting the digits of large numbers

A programmer wants to build a calculator for his boss. He knows that the largest number he will need to calculate is 25^75 (^ stands for power). Can you help him to find the maximal number of digits that will be output? NOTE: 1.Try to make a recursive solution; 2.Try to mix it with some classical maths too...😉😉

2nd Jul 2017, 1:46 PM
Ledio Deda
Ledio Deda - avatar
4 Answers
+ 2
There is my code that evaluates the number of digits for every number expressed as a^b https://code.sololearn.com/cuawYzqkQPat/?ref=app
2nd Jul 2017, 4:49 PM
Ledio Deda
Ledio Deda - avatar
+ 1
an easy upper estimate is that he will need at most 2*75=150 digits as he mutiplies a number with 2 digits (i.e. 25) 75 with each ihrer. as 25*25=625 has only 3 digits we can improve the upper estimate immediately: 25^75=25*25^37 and therefore he will need no more than 2+3*37=113 digits.
2nd Jul 2017, 3:50 PM
Volker Milbrandt
Volker Milbrandt - avatar
+ 1
I'm affraid the programmer will put 8 extra spaces for digits😕
2nd Jul 2017, 4:17 PM
Ledio Deda
Ledio Deda - avatar
+ 1
And the result is 105
2nd Jul 2017, 4:49 PM
Ledio Deda
Ledio Deda - avatar