$\gcd(a,b,c) = \gcd(a, \gcd(b, c))$, but is it possible to get $\gcd(b, c)$ from $\gcd(a, b, c)$?
Give a list of numbers, I want to efficiently compute the $\gcd$ of any slice of numbers from that list. A slice is a contiguous section of the list -- e.g. say from the third element to the tenth element. Say the list is $[a, b, c, d, e, ...]$. I was wondering if by precomputing $\gcd(a, b)$, $\gcd(a, b, c)$, $\gcd(a, b, c, d)$, $\gcd(a, b, c, d, e)$, etc. I can efficiently extract say $\gcd(c, d, e)$ (the $\gcd$ fo the slice from the third element to the fifth element) from $\gcd(a, b, c, d, e)$.
Your idea will not work. We have $\gcd(6,10)=2$, $\gcd(6,10,15)=1$, and $\gcd(10,15)=5$. On the other hand, we have $\gcd(6,10)=2$, $\gcd(6,10,7)=1$, and $\gcd(10,7)=1$. If there were to be such a function $f$ satisfying $f(\gcd(a,b),\gcd(a,b,c))=\gcd(a,b,c)$ for all $a,b,c$, then we would have $1=f(2,1)=5$, impossible.
One proposal by @Macavity and @Gribouillis in the comments is to store the gcd of some slices in a segment tree. Here's an example demonstrating how to use a segment tree for sum of slices.
For notational simplicity, use $[a,b]$ to represent the gcd of the slice from index $a$ and index $b$, inclusive. Use $s_1*s_2$ to represent $\gcd(s_1,s_2)$.The gcd of a single number is defined to be itself. It is not hard to verify that $[a,b]*[c,d]=[a,d]$.
To illustrate, suppose $n=5$ is the size of the array. Suppose we have constructed and stored the values of $[0,1],[0,2],[3,4],[0,4]$ and of course $[a,a]$ for any $0\le a<5$. Then, for example, $$ \begin{align*} [2,4] &= [2,2]*[3,4] \\ [1,4] &= [1,1]*[2,2]*[3,4] \\ [0,3] &= [0,2]*[3,3] \end{align*} $$ We can compute the gcd of any slice in $O(\log n)$ time.
By the way, finding the prime factorization of each number in the array, suggested by @Alma Arjuna, is certainly slower than the segment tree in most cases. Assuming integer division is $O(1)$, the time complexity of factorization of a number $a$ is $O(\sqrt{a})$, but that of taking gcd of $a$ and $b$ is $O(\log(a)+\log(b))$.