Suppose I have a set of numbers eg:{1,8,9,6,5,10} I want to keep a track of the first digit of the number obtained by multiplying the above numbers. 1*8*9*6*5*10 the answer is 21600 ,the first digit of which is 2. Now my question is how do I keep a track of first digit when I have many numbers to multiply . The resulting number can be very big ,but is not important here.So please suggest me a method to do it
Asked
Active
Viewed 859 times
0
-
You can't do it. You must keep track of all the digits. – TonyK Jun 06 '16 at 10:28
1 Answers
2
You can add up the base-10 logarithms, keeping track of the part after the decimal point, and, when you're done, compare the sum to the base-10 logs of $1,2,\dots,9$ to see what the first digit of the product is.
Gerry Myerson
- 179,216
-
It usually works well. But it won't always give the correct answer, because of rounding errors. – TonyK Jun 06 '16 at 11:31