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