Write a Python function to implement the Sieve of Eratosthenes algorithm for finding all prime numbers up to a given limit. The function should return a list of prime numbers.
PLAINFORMAT
def sieve_of_eratosthenes(limit):
    primes = []
    sieve = [True] * (limit + 1)
    
    # Iterate through numbers up to the square root of the limit
    for num in range(2, int(limit**0.5) + 1):
        if sieve[num]:
            primes.append(num)
            
            # Mark multiples of the current number as non-prime
            for multiple in range(num*num, limit + 1, num):
                sieve[multiple] = False
    
    # Add remaining prime numbers to the list
    for num in range(int(limit**0.5) + 1, limit + 1):
        if sieve[num]:
            primes.append(num)
    
    return primes