How to find the size of gaps between entries in an array so that the first and last element of the array is filled and the gaps are all of equal size?
If I understand your problem correctly, the tokens (lanterns) can be placed every $x$ blocks (starting from $0$) if and only if $x&gt;2$ is a divisor of  $n-1$.
For example, if the array has $n=31$ elements the valid values of $x$ are $3,5,6,10,15,$ and $30$.