prime

mail@pastecode.io avatar
unknown
python
a month ago
603 B
3
Indexable
Never
# 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)


Leave a Comment