You are increasing iter directly before the if condition to 1, which result in iter % 500 == 0 when iter reaches multiples of 500.
If you want to print the very first iteration, increase iter after the condition.