In the sequence This sequence can be continued forever, though the numbers very quickly grow enormous! (For example, the 14th term is close to some estimates of the number of particles in the observable universe.) What is the last digit of the 35th term of the sequence?
1,2,2,4,8,32,256,...
each term (starting from the third term) is the product of the two terms before it. For example, the seventh term is 256, which is the product of the fifth term (8) and the sixth term (32).
\(\begin{array}{lcrclclcl} a_1 &=& 1\\ a_2 &=& 2\\ a_3 &=& 2\\ a_4 &=& 4\\ a_5 &=& 8 \\ a_6 &=& 32 &=& 2^{1\cdot 2 + 1\cdot 3} &=& 2^{1\cdot 5 + 0\cdot 3} &=& 2^{5\cdot f_1 + 3\cdot f_0}\\ a_7 &=& 256 &=& 2^{1\cdot 2 + 2\cdot 3} &=& 2^{1\cdot 5 + 1\cdot 3} &=& 2^{5\cdot f_2 + 3\cdot f_1}\\ a_8 &=& 8192 &=& 2^{2\cdot 2 + 3\cdot 3} &=& 2^{2\cdot 5 + 1\cdot 3} &=& 2^{5\cdot f_3 + 3\cdot f_2}\\ a_9 &=& &=& 2^{3\cdot 2 + 5\cdot 3} &=& 2^{3\cdot 5 + 2\cdot 3} &=& 2^{5\cdot f_4 + 3\cdot f_3}\\ a_{10} &=& &=& 2^{5\cdot 2 + 8\cdot 3} &=& 2^{5\cdot 5 + 3\cdot 3} &=& 2^{5\cdot f_5 + 3\cdot f_4}\\ a_{11} &=& &=& 2^{8\cdot 2 + 13\cdot 3} &=& 2^{8\cdot 5 + 5\cdot 3} &=& 2^{5\cdot f_6 + 3\cdot f_5}\\ a_{12} &=& &=& 2^{13\cdot 2 + 21\cdot 3} &=& 2^{13\cdot 5 + 8\cdot 3} &=& 2^{5\cdot f_7 + 3\cdot f_6}\\ a_{13} &=& &=& 2^{21\cdot 2 + 34\cdot 3} &=& 2^{21\cdot 5 + 13\cdot 3} &=& 2^{5\cdot f_8 + 3\cdot f_7}\\ a_{14} &=& &=& 2^{34\cdot 2 + 55\cdot 3} &=& 2^{34\cdot 5 + 21\cdot 3} &=& 2^{5\cdot f_9 + 3\cdot f_8}\\ a_{15} &=& &=& 2^{55\cdot 2 + 89\cdot 3} &=& 2^{55\cdot 5 + 34\cdot 3} &=& 2^{5\cdot f_{10} + 3\cdot f_9}\\ a_{16} &=& &=& &=& 2^{89\cdot 5 + 55\cdot 3} &=& 2^{5\cdot f_{11} + 3\cdot f_{10}}\\ \dots \\ a_{35} &=& &=& &=& &=& 2^{5\cdot f_{30} + 3\cdot f_{29}} \end{array}\)
Fibonacci numbers: \(f_n = f_{n-1} + f_{n-2} \text{ with } f_0 = 0 \text{ and } f_1 = 1.\)
\(\begin{array}{lcllcllcl} f_{0} &=& 0, \quad & \quad f_{1} &=& 1,\quad & \quad f_{2} &=& 1, \quad & \quad f_{3} &=& 2, \\ f_{4} &=& 3, \quad & \quad f_{5} &=& 5, \quad & \quad f_{6} &=& 8, \quad & \quad f_{7} &=& 13, \\ f_{8} &=& 21, \quad & \quad f_{9} &=& 34, \quad & \quad f_{10} &=& 55, \quad & \quad f_{11} &=& 89, \\ f_{12} &=& 144, \quad & \quad f_{13} &=& 233, \quad & \quad f_{14} &=& 377, \quad & \quad f_{15} &=& 610, \\ f_{16} &=& 987, \quad & \quad f_{17} &=& 1597, \quad & \quad f_{18} &=& 2584, \quad & \quad f_{19} &=& 4181, \\ f_{20} &=& 6765, \quad & \quad f_{21} &=& 10946, \quad & \quad f_{22} &=& 17711, \quad & \quad f_{23} &=& 28657, \\ f_{24} &=& 46368, \quad & \quad f_{25} &=& 75025, \quad & \quad f_{26} &=& 121393, \quad & \quad f_{27} &=& 196418, \\ f_{28} &=& 317811, \quad & \quad f_{29} &=& 514229, \quad & \quad f_{30} &=& 832040, \quad & \quad f_{31} &=& 1346269,\\ f_{32} &=& 2178309, \quad & \quad f_{33} &=& 3524578, \quad & \quad f_{34} &=& 5702887, \quad & \quad f_{35} &=& 9227465, \\ f_{36} &=& 14930352, \quad & \quad f_{37} &=& 24157817, \quad & \quad f_{38} &=& 39088169, \quad & \quad \dots \end{array} \)
\(\begin{array}{rcll} a_{35} &=& 2^{5\cdot f_{30} + 3\cdot f_{29}} \qquad & | \qquad f_{30} &=& 832040 \qquad f_{29} &=& 514229 \\\\ a_{35} &=& 2^{5\cdot 832040 + 3\cdot 514229} \\ a_{35} &=& 2^{5702887} \\ \end{array}\)
What is the last digit of the 35th term of the sequence ?
\(\begin{array}{rcll} 2^{5702887} \pmod {10 } = \ ? \end{array}\)
\(\boxed{~ \begin{array}{rcll} 2^{33} & \equiv & 2^1 \pmod {10}\\ \Rightarrow 2^{33\cdot 33} & \equiv & (2^{33})^{33} \equiv (2^1)^{33} \equiv 2^1 \pmod {10}\\ \Rightarrow 2^{(33^n)} & \equiv & 2^1 \pmod {10}\\ \Rightarrow 2^{a\cdot(33^n)} & \equiv & 2^a \pmod {10}\\ \end{array} ~} \)
\(\begin{array}{rclcrcr} \frac{5702887}{33^4} &=& \frac{5702887}{1185921} &=& 4 &\text{ remainder }& 959203 \\ \frac{959203}{33^3} &=& \frac{5702887}{35937} &=& 26 &\text{ remainder }& 24841 \\ \frac{24841}{33^2} &=& \frac{5702887}{1089} &=& 22 &\text{ remainder }& 883 \\ \frac{883}{33} && &=& 26 &\text{ remainder }& 25 \end{array}\\ \begin{array}{rclcrcr} 5702887 &=& 4\cdot 33^4 + 26\cdot 33^3 + 22\cdot 33^2 + 26\cdot 33 + 25 \\\\ && 2^{5702887} \pmod {10 } \\ &=& 2^{4\cdot 33^4 + 26\cdot 33^3 + 22\cdot 33^2 + 26\cdot 33 + 25 } \pmod {10 } \\ &=& 2^{4\cdot 1 + 26\cdot 1 + 22\cdot 1 + 26\cdot 1 + 25 } \pmod {10 } \\ &=& 2^{4 + 26 + 22 + 26 + 25 } \pmod { 10 } \\ &=& 2^{103 } \pmod { 10 } \\ &=& 2^{33\cdot 3 + 4 } \pmod { 10 } \\ &=& 2^{1 \cdot 3 + 4 } \pmod { 10 } \\ &=& 2^{3 + 4 } \pmod { 10 } \\ &=& 2^{7 } \pmod { 10 } \\ &=& 128 \pmod { 10 } \\ &=& 8 \pmod { 10 } \end{array}\)
the last digit of the 35th term of the sequence is 8