#K58262. Consecutive Prime Ranges
Consecutive Prime Ranges
Consecutive Prime Ranges
Given a positive integer \( n \), your task is to generate and print all consecutive sequences (ranges) of prime numbers less than or equal to \( n \) where the difference between consecutive primes in each sequence is exactly \(2\). The sequences should be printed on separate lines with each prime number separated by a space.
For example, for \( n = 13 \), the consecutive prime ranges are:
3 5 7 11 13
If no primes (or no consecutive sequence) exist, print an empty output.
inputFormat
A single line containing an integer ( n ) (where ( n \ge 0 )).
outputFormat
For each consecutive prime range, print the prime numbers separated by a space on a new line. If there is no consecutive range, output nothing.## sample
13
3 5 7
11 13
</p>