Your code does not meet the specifications laid down:
Quote:
Output
For each input of the test case, you need to print 2 lines.
First line should have 1 value - the number of terms in the series.
2nd line of the output should print the series numbers separated by single space.
Your's does not do that: it prints a single line of
n
items separated by spaces.
Unless it provides exactly the output requested, it will fail automatically.