Take any arbitrary value of i, let i=4
Then inner most statement runs as--
(1to4 + 1to 8 + 1to 12 + 1to 16 ) due to the condition j(mod) i becomes true. +
For j=(1,2,3, 5,6,7 ,9,10,11, 13,14,15) i.e. 3*4 times due to j loop only.
Therefore for any i=m statements runs
m* (m-1)+ m(1+2+3+.....+m) times
=m*(m-1)+m{m(m+1)/2} times
So for i=1 to n
=> Σ(m*(m-1) + m{m(m+1)/2} ) [m=1 to n]
=> leading term =(Σ(${m^3}$))=O(${n^4}$).