Gcd(n, d) is the total number of cyclic sequences formed by shifting array by d everytime.

Правка en2, от ganesh_6, 2022-05-02 13:49:42

I am solving the problem https://codeforces.me/contest/1579/problem/F . Although I got the idea to solve it, I could not get the mathematical formula or intuition that the number of cyclic sequences formed can be gcd(a, b).

From the editorial https://codeforces.me/blog/entry/95447, I came to know that "Note that by shifts of d the array splits into gcd(n, d) cyclic sequences of this kind, each of length n/gcd(n, d)".

Can anyone explain the mathematical intuition or provide some explanation for this formula? Thanks in advance!

Теги gcd, rotate

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский ganesh_6 2022-05-02 13:49:42 2 Tiny change: '79/probleml/F. Although' -> '79/problem/F . Although'
en1 Английский ganesh_6 2022-05-02 12:58:51 630 Initial revision (published)