The challenge is to write a function that prints the number of repeats a given array of integers has.
What are repeats?
Repeats of a slice (as in a section of an array)
[ a1, a2, a3, ..., an] are any other non-overlapping slices of the forms
[ a1+an, a2+an, a3+an, ..., an+an],
[ a1+2an, a2+2an, a3+2an, ..., an+2an], and so on. Incomplete repeats, e.g.
[ a1+3an, a2+3an], are not counted.
Input and output
Inputs should be ordered collections of integers, e.g. arrays, lists, tuples, etc. The integers will be sorted and unique.
Output a single integer that is the number of repeats that covers the whole input. The output should correspond to the greatest possible number of repeats. E.g. certain inputs could be modeled to have 3 repeats of a 4-element slice, or 6 repeats of a 2-element slice; 6 should be the output because it is greater than 3.
Input -> Output [ 1, 3, 5, 6, 8, 10, 11, 13, 15, 16, 18, 20] -> 4 [ 3, 5, 7, 10, 13, 15] -> 1 [1, 2, 3] -> 3 [1,2,4] -> 1 [ 3, 5, 7, 9, 12,14,16,18] -> 2
This is a code-golf challenge, so the shortest code possible wins
If you have any questions related to the challenge feel free to ask.
I know that my attempts to explain something can be difficult to understand sometimes.