Consider the numbers b1=a1, b2=a1+a2, ... up to bN=a1+a2+...+aN. Let ci=bi mod N. If some ci=0, then a1+a2+...+ai is a solution. On the other hand, if no ci=0, at least two of the ci values must be the same, since there are just (N-1) possible nonzero values. If ci=cj, then ai+1+ai+2+...+aj is a solution. |