That's how you solve all problems of this form. For any a and b, a^n mod b eventually becomes periodic as n grows. It's easy to prove because there's only a finite number of possible remainders mod b. As an exercise, calculate 3^1000000 mod 7.
3 is prime. 34240923842043983204982 is divisible by 3 - 1 = 2.
ab mod n = [a mod n * b mod n] mod n
So, we can automatically infer that 2 ^ 34240923842043983204982 ~= 1 mod 3.
After subtracting 1, it will be divisible by 3.
Alternatively, you could notice that 2 ^ 2 ~= 1 mod 3, which implies 2 ^ 4 ~= 1, 2 ^ 6 ~= 1, so 2 ^ all even powers will be congruent to 1 modulo 3.
So 2 ^ x - 1 will always be divisible by 3 for even x.
The proof is left as an exercise for the student.
To check, 2^6-1=63 is divisible by three (it might work), but 2^9-1 has a sum of 12 and a value of 511, which is not divisible by three (it's 170 * 3 = 510 + 1).