#K12316. Prime Sequence Generator

    ID: 23664 Type: Default 1000ms 256MiB

Prime Sequence Generator

Prime Sequence Generator

In this problem, you are given two integers (k) and (n). Your task is to generate a sequence of (n) numbers where the first number is exactly (k) and every subsequent number is the next prime number greater than the previous number (ignoring whether (k) itself is prime or not). Recall that a number (p) is considered prime if it is greater than 1 and has no positive divisors other than 1 and itself, i.e., (p > 1) and (\forall d \in [2, \sqrt{p}],; d \nmid p).

For example, if (k = 1) and (n = 5), the sequence is: [1, 2, 3, 5, 7].

inputFormat

The input will be provided via standard input. The first line contains two space-separated integers (k) and (n), where (k) is the starting number and (n) is the length of the sequence to generate.

outputFormat

Output the generated sequence as (n) space-separated integers on a single line to standard output.## sample

1 5
1 2 3 5 7