In a programming exercise, I need to find out the modulus of a very large number like 2 raise to power 500000(maximum number in input), with 1000000007 as a part of other computation.
As I may have to find out many times, one way is I create an array of 5,00,000. but it will is blocking a huge amount of memory, so I want to know is there any better way to do this ?