# What is the sequence of numbers for N = 6? [closed]

The numbers in the table below are the result of executing an algorithm that has one parameter N, a non-negative integer, and produces sequences of integers as outputs. For values of N from 0 to 5, the algorithm produces the following sequences of numbers as outputs.

• I'm voting to close this question as off-topic because it is a puzzle rather than a technical question. – Yuval Filmus Oct 5 '19 at 22:56

Here is one possible algorithm:

• If $$N = 0$$, output the empty string.
• If $$N = 1$$, output "0 1".
• If $$N = 2$$, output "0 2 2 3".
• If $$N = 3$$, output "0 2 4 3 4 5".
• If $$N = 4$$, output "0 2 4 6 4 5 6 7".
• If $$N = 5$$, output "0 2 4 6 8 5 6 7 8 9".
• Otherwise, output the empty string.

Now, this is probably not the answer they were expecting, but it's perfectly valid.

(The answer they expected was: output the first $$N$$ even integers starting with zero, and then the first $$N$$ integers starting with $$N$$.)

• answer of the sequence – Saad Mohamed Oct 4 '19 at 13:57
• Trick question $\Rightarrow$ trick answer! – HEKTO Oct 4 '19 at 13:59
• I was about to say the same thing! These kind of "problems" are really annoying. There is literally a countable infinity of algorithms that produce that same output. Why should one be preferred (notice that it says "determine the algorithm that was used [...]"? – Steven Oct 4 '19 at 14:21