Ladders interview question

Write a function that, given a number n, prints all primes <= n.