Generate Recamán's sequence
CJam, 34 33 bytes

0ali{_W=_I-__0&lt;4$@#)|@I+@?+}fI1&gt;`


Try it online.

Example run

$ cjam &lt;(echo '0ali{_W=_I-__0&lt;4$@#)|@I+@?+}fI1&gt;`') &lt;&lt;&lt; 33
[0 1 3 6 2 7 13 20 12 21 11 22 10 23 9 24 8 25 43 62 42 63 41 18 42 17 43 16 44 15 45 14 46]


How it works

0ali                               " Push S := [ 0 ] and read an integer N from STDIN.    ";
    {                      }fI     " For each I in [ 0 ... (N - 1) ]:                     ";
     _W=                           "   X := S[-1].                                        ";
        _I-                        "   Y := X - I                                         ";
            _0&lt;                    "   A := (Y &lt; 0)                                       ";
           _   4$@#)               "   B := (Y ∊ S)                                       ";
                     @I+           "   Z := X + I                                         ";
                    |   @?         "   C := (A || B) ? Z : Y                              ";
                          +        "   S += [C]                                           ";
                              1&gt;`  " Push str(S[1:]).                                     ";