fozzy,
you are correct in both cases. here is how i like to think about it:
7^{777} example:
If we divide 777 by 4, the quotient is 194 and the remainder is 1.
This means that we will have 194 of {7, 9, 3, 1} repeating blocks, and we will have 1 more term left, and the units digit of 7^{777} will be 7, the first term in the repeating block.
When we look at the case of 344^{328}, the units digit of powers of 4 cycle as {4, 6}, when we divide 328 by 2, the remainder is 0, this means that there will be exactly 164 blocks consisting of {4,6} without any remainder and the units digit of 344^{328} will be 6.
here are problems using the same concept(some hard):
#1)
if-n-is-a-positive-integer-what-is-the-remainder-when-82380.html#2)
what-is-the-remainder-when-7-345-7-11-2-is-divided-by-26794.html#3)
remainder-when-7-4n-3-6-n-104848.html#4)
if-3-4n-1-is-divided-by-10-can-the-remainder-be-0-a-4662.html#5)
what-s-the-remainder-of-2-x-divided-by-10-1-x-is-an-even-9651.htmlcheers,
dabral