- Edited
Given any array of n elements, and a integer number k (positive or negative).
Starting at index 0 for the first element and going through the array with k increments and wrapping around the array, the elements are deemed equivalent (or belonging to the same set).
How many sets are there for each (n, k) pair?
Note: Any equivalent formulation could work, especially for indexing starting with 1 where you have to be careful about the wrap around.
(n=2, k=0) = 2 sets
(n=2, k=1) = 1 set
(n=2, k=2) = 2 sets
(n=10, k=2) = 2 sets
0 1 2 3 4 5 6 7 8 9
(n=10, k=5) = 5 sets
0 1 2 3 4 5 6 7 8 9
(n=11, k=2) = 1 set
Starting at index 0 for the first element and going through the array with k increments and wrapping around the array, the elements are deemed equivalent (or belonging to the same set).
How many sets are there for each (n, k) pair?
Note: Any equivalent formulation could work, especially for indexing starting with 1 where you have to be careful about the wrap around.
(n=2, k=0) = 2 sets
(n=2, k=1) = 1 set
(n=2, k=2) = 2 sets
(n=10, k=2) = 2 sets
0 1 2 3 4 5 6 7 8 9
(n=10, k=5) = 5 sets
0 1 2 3 4 5 6 7 8 9
(n=11, k=2) = 1 set