How can a loop be implemented in Python which returns the indices of tree branches and where the number of tree branches per layer depth grows by n to the power of the layer