// Define a function to check if a number is prime function isPrime(n): if n <= 1: return False for i from 2 to n-1: if n % i == 0: return False return True // Loop through all 3-digit numbers starting with 5 for num from 500 to 599: // Check if the number is prime and has 3 digits if isPrime(num) and len(str(num)) == 3: // Display the prime number print(num)