Dream of Divisibility Help [Python]

Coding problem: DREDIV
https://www.codechef.com/LTIME92C/problems/DREDIV

Below is the solution from p_sai_vamsi:
[p_sai_vamsi] Solution: 42098007 | CodeChef

Could anyone please tell what’s this unique approach?