#K8076. List Prime Numbers
List Prime Numbers
List Prime Numbers
Given a positive integer \(n\), your task is to compute and print all prime numbers less than or equal to \(n\). A prime number is a natural number greater than 1 that has no divisors other than 1 and itself. Use efficient methods to check for primes.
inputFormat
The input consists of a single integer \(n\) (\(1 \le n \le 10^6\)) provided via standard input.
outputFormat
Output all prime numbers less than or equal to \(n\) in ascending order, separated by a single space. If there are no prime numbers, output an empty line.
## sample1