#K36937. Find Factor Pairs
Find Factor Pairs
Find Factor Pairs
Given a positive integer \(K\), your task is to find all pairs of integers \((x, y)\) such that:
- \(1 \le x \le y \le K\)
- \(x \times y = K\)
The pairs must be listed in increasing order of \(x\). Each pair should be printed on a separate line with the numbers separated by a space.
For example, when \(K = 12\), the valid pairs are:
1 12 2 6 3 4
Note: Use efficient algorithms to pass the larger constraints.
inputFormat
The input consists of a single integer \(K\) (\(1 \le K \le 10^6\)) provided via stdin.
outputFormat
Output all pairs \((x, y)\) meeting the criteria. Each pair must be printed on a new line with \(x\) and \(y\) separated by a space. The output should be directed to stdout.
## sample12
1 12
2 6
3 4
</p>