for i in range(501,600,2): isPrime = True j = 3 while(j * j <= i): if (i % j == 0): isPrime = False break j+=2 if (isPrime == True): print(i,end=" ")