  Sure! Here is a Python implementation of the algorithm you described:
```
def prime_numbers_up_to(x):
    prime_numbers = [2]
    for i in range(3, int(x ** 0.5) + 1):
        if i not in prime_numbers:
            prime_numbers.extend(i * k for k in range(2, int(x ** 0.5) + 1) if i * k <= x)
    return prime_numbers
```
This algorithm is known as the Sieve of Eratosthenes.

Here's a brief explanation of how the code works:

1. We start by initializing a list `prime_numbers` with the number 2, since 2 is the first prime number.
2. We then iterate over the numbers from 3 to the square root of x (inclusive). For each number `i`, we check if it has not been marked as a non-prime number (i.e., `i not in prime_numbers`). If it hasn't, we mark all its multiples up to x as non-prime numbers by extending the `prime_numbers` list with all the multiples of `i` that are less than or equal to x.
3. Finally, we return the `prime_numbers` list, which now contains all the prime numbers up to x.

You can test the function with some examples:
```
print(prime_numbers_up_to(10))  # [2, 3, 5, 7, 9]
print(prime_numbers_up_to(20))  # [2, 3, 5, 7, 11, 13, 17, 19]
print(prime_numbers_up_to(30))  # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
```
I hope this helps! Let me know if you have any questions or need further clarification.