Generate Hofstadter's Figure-Figure Sequence In Gödel, Escher, Bach, Douglas Hofstadter introduces an integer sequence which is commonly referred to as the figure-figure sequence:

2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, ...


You may enjoy working out the definition of the sequence yourself as part of the challenge, but if you can't or don't want to figure it out you can find it on OEIS as sequence A030124 and a slightly clearer definition on Wikipedia.

Write a program or function which, given n via STDIN, ARGV or function argument, prints a list of the first n numbers of the sequence to STDOUT in any reasonable list format.

This is code golf, the shortest solution in bytes wins.
CJam, 38 30 29 21 bytes

li_3*,2&gt;\{(_pX+:X-}*;


Try it online.

How it works

li                     " Read an integer N from STDIN.              ";
  _3*,2&gt;               " Push S := [ 2 3 ... (N * 3 - 1) ].         ";
        \{        }*   " Do the following N times:                  ";
          (            " Shift an integer I from S.                 ";
           _p          " Print a copy of I, followed by a linefeed. ";
             X+:X      " Execute X += I. (X is initialized to 1.)   ";
                 -     " Remove X from S.                           ";
                    ;  " Discard S from the stack.                  ";


Example run

$ cjam &lt;(echo 'li_3*,2&gt;\{(_pX+:X-}*;') &lt;&lt;&lt; 20
2
4
5
6
8
9
10
11
13
14
15
16
17
19
20
21
22
23
24
25