Given an input integer
n >= 10, output the average of all deduplicated rotations of the integer.
For example, for input
123, the rotations are
123 (no rotation),
231 (one rotation) and
312 (two rotations). The average of those is
(123 + 231 + 312) / 3 or
As another example, take
4928. The rotations are
8492. Taking the average of those four numbers equals
For another example, for input
445445, the deduplicated rotations are
544544, so the output is
777, there is only one deduplicated rotation, so the output is
- If applicable, you can assume that the input/output will fit in your language's native Integer type.
- The input and output can be given by any convenient method.
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.