#K41142. Taco Sequence Generator

    ID: 26800 Type: Default 1000ms 256MiB

Taco Sequence Generator

Taco Sequence Generator

You are given two integers \(n\) and \(k\). Starting from \(n\), generate a sequence of \(k\) numbers according to the following rules in each iteration:

  • If the current number is divisible by both \(3\) and \(5\) (i.e. \(3 \mid n\) and \(5 \mid n\)), keep it unchanged and append it to the sequence.
  • If the current number is divisible by \(3\) but not by \(5\) (i.e. \(3 \mid n\) and \(5 \nmid n\)), double the number and append the result.
  • If the current number is divisible by \(5\) but not by \(3\) (i.e. \(5 \mid n\) and \(3 \nmid n\)), perform an integer division by 2 and append the result.
  • If none of the above conditions hold, add \(7\) to the current number and append it to the sequence.

For example, if \(n = 6\) and \(k = 3\), the resulting sequence is: [12, 24, 48].

inputFormat

The input consists of two space-separated integers read from standard input. The first integer is \(n\), the starting number, and the second integer is \(k\), representing the number of iterations to perform.

Example: 6 3

outputFormat

Output the generated sequence as a single line with each number separated by a single space, written to standard output.

Example: 12 24 48

## sample
6 3
12 24 48