title: Finding period of a sequence
body: <p>I want to solve this problem:<br /></p>
  
  <p>For a given sequence, <code>a[0], a[1], a[2],..., a[n-1]</code>, please find "period" of the sequence.<br />
  The period is the minimum integer k (k >= 1) that satisfies a[i] = a[i+k] for all valid i, and also k is a divisor of n.</p>
  
  <p>My current solution is calculating all divisor of n (this is k) and test for all k, but it takes <code>O(n * d(n))</code>. I think it is slow.<br />
  Is there any efficient algorithm?</p>