The most efficient way to code powers of two is by bit shifting of integers.
1 << n gives me 2^n
However, if I have a number that is larger than the largest value allowed in an int or a long, what can I use to efficiently manipulate powers of 2?
(I need to be able to perform addition, multiplication, division and modulus operations on the number)
Is this what you need?
This is the result when n=1000,