start, period, step, res = 2, 24, 7, []
now = start
while True:
now += step
if now >= period:
now -= period
if now not in res:
res.append(now)
if now == start:
break
<class 'list'>: [9, 16, 23, 6, 13, 20, 3, 10, 17, 0, 7, 14, 21, 4, 11, 18, 1, 8, 15, 22, 5, 12, 19, 2]
period*k=step*n
当period与step互质,最小的n为period,此时k=step。
求period与step的最小公倍数