简体   繁体   中英

1st digit before taking modulo(10**9 + 7)

I am multiplying many large numbers and finally taking modulo of it. To optimise this I am using MOD at each step. But I also want the 1st digit of the final answer. Is there any way to know that even after using MOD?

Or is there any other efficient way to do huge multiplication many times, get the final answer and extract the 1st digit from it?

Order of elements is 10^9 and number of multiplications is about 10^5

take 10 based logarithms, sum them up and take the fractional part of the sum.

think about scientific notation of large numbers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM