Prime
unknown
python
10 months ago
599 B
4
Indexable
# Function to check if a number is prime def is_prime(n): if n < 2: return False for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True # Find all prime numbers with 3 digits starting with 5 def find_primes_starting_with_5(): primes = [] for num in range(500, 600): if is_prime(num): primes.append(num) return primes # Call the function and display the prime numbers prime_numbers = find_primes_starting_with_5() print("Prime numbers with 3 digits starting with 5:", prime_numbers)
Editor is loading...
Leave a Comment