Let p6463079898728652014222843599619370381132154960614345452
Let
p=646307989872865201422284359961937038113215496061434545237.
Find the last 6 digits of x = 143p. The number x is quite large, but last 6 digits of x are only 6 digits long.
Try to speed up your program as fast as possible without concerning memory space. Output should include the running time of your program and results for A(2,5) and the 6 digits of x.
Solution
Well the answer is 968891. You can always do in python (python can handle very big numbers!!)
p = 646307989872865201422284359961937038113215496061434545237
print 143*p
This is the python code.
On the other hand if you want C++ code then all you need to do multiply last 6 digits of p which is 545237 with 143
545237*143 = 77968891. Then last 6 digit of 77968891 is 968891 which matches with our answer!!!
The time complexity is O(m) where m is the no. of bits in 143
