For a programming question I have to print the expression 2^n+2^n-1+...+2^k mod 2^60, where 1<=k<n<=240?
Basically, how can I calculate 2^240 mod 2^60? If this can be solved, I can make it work for n<240 as well!
I read an answer here: How can I calculate 2^n for large n?
But, that calculates for large values of n and not 2^n.
Any help?