First digit of a very long number

862 Views Asked by At

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

1

There are 1 best solutions below

1
On BEST ANSWER

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.