// Sieve of Eratosthenes n = eval[input["Enter highest number: "]] results = array[sieve[n]] println[results] println[length[results] + " prime numbers less than or equal to " + n] sieve[n] := { // Initialize array array = array[0 to n] array@1 = 0 for i = 2 to ceil[sqrt[n]] if array@i != 0 for j = i^2 to n step i array@j = 0 return select[array, { |x| x != 0 }] }