[Question]
  [
*This question is probably harder than all of those "generate a sequence of numbers" tasks, because this requires TWO sequences working in unison.*
*Really looking forward to the answers!*
In his book "*Gödel, Escher, Bach: An Eternal Golden Braid*", Douglas Hofstadter has a quite few sequences of numbers inside, all of them rely on the previous term in some way. For information on all of the sequences, see [this Wikipedia page](https://en.wikipedia.org/wiki/Hofstadter_sequence).
One pair of sequences that's really interesting is the Female and Male sequences, which are defined like so:
[![](https://i.stack.imgur.com/Q5bxO.png)](https://i.stack.imgur.com/Q5bxO.png)
for `n > 0`.
Here's the [Female sequence](http://oeis.org/A005378) and the [Male sequence](http://oeis.org/A005379).
Your task is, when given an integer `n` as input, return a list of the Female sequence and the Male sequence, with the amount of terms equal to `n`, in two lines of output, with the Female sequence on the first line and the Male sequence on the second.
Sample inputs and outputs:
Input: `5`
Output: `[1, 1, 2, 2, 3]` `[0, 0, 1, 2, 2]`
Input: `10`
Output: `[1, 1, 2, 2, 3, 3, 4, 5, 5, 6]` `[0, 0, 1, 2, 2, 3, 4, 4, 5, 6]`
NOTE: The separation between lists signifies a line break.
This is code-golf, so shortest code in bytes wins. Also, put an explanation in as well for your code.
## Leaderboard
```
var QUESTION_ID=80608,OVERRIDE_USER=49561;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```
  
[Answer]
# Julia, ~~52~~ 48 bytes
```
x->[n÷φ|(5n^2|4∈(2:3n).^2)for| =(+,-),n=1:x]
```
[Try it online!](http://julia.tryitonline.net/#code=MzUgfD4geC0-W27Dt8-GfCg1bl4yfDTiiIgoMjozbikuXjIpZm9yfCA9KCssLSksbj0xOnhdIHw-IGludCB8PiBwcmludA&input=)
### Background
In [On Hofstadter's married functions](http://iecl.univ-lorraine.fr/~Thomas.Stoll/hofstadter.ps), the author shows that
![F/M formula](https://i.stack.imgur.com/CJwuW.png)
where **φ** denotes the [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio),
![delta/epsilon formula](https://i.stack.imgur.com/4GVoF.png)
and **Fn** denotes the **n**th [Fibonacci number](https://en.wikipedia.org/wiki/Fibonacci_number).
Furthermore, in [Advanced Problems and Solutions, H-187: Fibonacci is a square](http://www.fq.math.ca/Scanned/10-4/advanced10-4.pdf), the proposer shows that
![Fibonacci/Lucas identity](https://i.stack.imgur.com/NN5DR.png)
where **Ln** denotes the **n**th [Lucas number](https://en.wikipedia.org/wiki/Lucas_number), and that – conversely – if
![converse Fibonacci/Lucas identity](https://i.stack.imgur.com/yB3Qn.png)
then **n** is a Fibonacci number and **m** is a Lucas number.
From this, we deduce that
![delta/epsilon theorem](https://i.stack.imgur.com/ixirM.png)
whenever **n > 0**.
### How it works
Given input **x**, we construct a **2** by **x** matrix, where **|** is addition in the first column and subtraction in the second, and **n** iterates over the integers between **1** and **x** in the rows.
The first term of both **F(n - 1)** and **M(n - 1)** is simply `n÷φ`.
We compute **δ(n)** and **ε(n)** by calculating **5n² | 4** and testing if the result belongs to the array of squares of the integers between **2** and **3n**. This tests both for squareness and, since **1** is not in the range, for **n > 1** if **|** is subtraction.
Finally we add or subtract the Boolean resulting from `5n^2|4∈(2:3n).^2` to or from the previously computed integer.
[Answer]
# Python 2, ~~79~~ 70 bytes
```
a=0,;b=1,
exec"a,b=b,a+(len(a)-b[a[-1]],);"*~-input()*2
print b,'\n',a
```
Iterative rather than recursive, because why not. The first line has a trailing space - if that's not okay it can be fixed for an extra byte. -9 bytes thanks to @Dennis.
Here are some combined lambdas which didn't really help:
```
f=lambda n,k:n and n-f(f(n-1,k),k^1)or k
f=lambda n,k:[k][n:]or f(n-1,k)+[n-f(f(n-1,k)[-1],k^1)[-1]]
```
Both take `n` and a parameter `k` either 0 or 1, specifying male/female. The first lambda returns the nth element, and the second lambda returns the first n elements (with exponential runtime).
[Answer]
# [MATL](https://github.com/lmendo/MATL), 23 bytes
```
1Oiq:"@XJth"yy0)Q)_J+hw
```
[**Try it online!**](http://matl.tryitonline.net/#code=MU9pcToiQFhKdGgieXkwKVEpX0oraHc&input=MTA)
### Explanation
This works iteratively. Each sequence is kept in an array. For each index *n* the new term of each sequence is computed and attached to the corresponding array. A `for` loop with *N*−1 terms is used, where *N* is the input number.
The update for sequence M needs to be done first. This is because sequence F is always greater than or equal to sequence M for the same index, so if we tried to update F first we would need a term of M not computed yet.
The two update equations are the same interchanging F and M. Thus the code for the updating is reused by applying a `for` loop with two iterations and swapping the sequences in the stack.
```
1        % Push 1: seed for F sequence
O        % Push 0: seed for M sequence
iq:      % Input N. Generate range [1 2 ... N-1]
"        % For each (i.e. iterate N-1 times)
  @      %   Push current index, n (starting at 1 and ending at N-1)
  XJ     %   Copy to clipboard J
  th     %   Duplicate and concatenate. This generates a length-2 array
  "      %   For each (i.e. iterate twice)
    yy   %   Duplicate top two elements, i.e. F and M sequences
    0)   %     In the *first* iteration: get last entry of M, i.e M(n-1)
    Q)   %     Add 1 and index into F. This is F(M(n-1))
    _J+  %     Negate and add n. This is n-F(M(n-1)), that is, M(n)
    h    %     Concatenate to update M
    w    %     Swap top two elements, to bring F to top.
         %     In the *second* iteration the procedure is repeated to update F,
         %     and then the top two elements are swapped to bring M to top again,
         %     ready for the next iteration of the outer loop
         %   End for implicitly
         % End for implicitly
         % Display implicitly from bottom to top: first line is F, second is M
```
[Answer]
# J, 47 bytes
```
f=:1:`(-m@f@<:)@.*
m=:0:`(-f@m@<:)@.*
(f,:m)@i.
```
Uses the recursive definition. The first two lines define the verbs `f` and `m` which represent the female and male functions, respectively. The last line is a verb that takes a single argument `n` and outputs the first `n` terms of the female and male sequences.
## Usage
```
   (f,:m)@i. 5
1 1 2 2 3
0 0 1 2 2
   (f,:m)@i. 10
1 1 2 2 3 3 4 5 5 6
0 0 1 2 2 3 4 4 5 6
```
[Answer]
## JavaScript (ES6), 75 bytes
```
g=n=>--n?([f,m]=g(n),m=[...m,n-f[m[n-1]]],[[...f,n-m[f[n-1]]],m]):[[1],[[0]]
```
I could save 2 bytes if I was allowed to return the Male sequence first:
```
g=n=>--n?([f,m]=g(n),[m=[...m,n-f[m[n-1]]],[...f,n-m[f[n-1]]]]):[[1],[[0]]
```
[Answer]
## Haskell, 57 bytes
```
l#s=scanl(\a b->b-l!!a)s[1..]
v=w#1
w=v#0
(<$>[v,w]).take
```
Usage example: `(<$>[v,w]).take $ 5` -> `[[1,1,2,2,3],[0,0,1,2,2]]`
The helper function `#` builds an infinite list with starting value `s` and a list `l` for looking up all further elements (at index of the previous value). `v = w#1` is the female and `w = v#0` the male sequence. In the main function we take the first `n` elements of both `v` and `w`. 
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), ~~22~~ 20 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ṙṪḢạL}ṭ
çƓḤ¤Ð¡1ṫ-Ṗ€G
```
[Try it online!](http://jelly.tryitonline.net/#code=4bmZ4bmq4bii4bqhTH3hua0Kw6fGk-G4pMKkw5DCoTHhuast4bmW4oKsRw&input=MjA)
### How it works
```
çƓḤ¤Ð¡1ṫ-Ṗ€G  Main link. No user arguments. Left argument defaults to 0.
   ¤          Combine the two links to the left into a niladic chain.
 Ɠ              Read an integer from STDIN.
  Ḥ             Unhalve/double it.
ç   Ð¡1       Call the helper link that many times. Return all results.
              In the first call, the left and right argument are 0 and 1 resp.
              After each iteration, the left argument is set to the return value
              and the right argument to the prior value of the left one.
       ṫ-     Tail -1; keep the last two items of the list of results.
         Ṗ€   Discard the last item of each list.
           G  Grid; format the pair of lists.
ṙṪḢạL}ṭ       Helper link. Arguments: x, y (lists)
ṙ             Rotate x k units to the left, for each k in y.
 Ṫ            Tail; extract the last rotation.
  Ḣ           Head; extract the last element.
              This essentially computes x[y[-1]] (Python notation), avoiding
              Jelly's 1-based indexing.
    L}        Yield the length of y.
   ạ          Take the absolute difference of the results to both sides.
      ṭ       Tack; append the difference to y and return the result.
```
[Answer]
## Python 2, 107 bytes
```
F=lambda n:n and n-M(F(n-1))or 1
M=lambda n:n and n-F(M(n-1))
n=range(input())
print map(F,n),'\n',map(M,n)
```
[Try it online](http://ideone.com/fork/H57Qef)
Larger input values cause a RuntimeError (too much recursion). If this is a problem, I can write a version where the error doesn't happen.
[Answer]
## Clojure, ~~132~~ 131 bytes
```
(fn [n](loop[N 1 M[0]F[1]](if(< N n)(let[M(conj M(- N(F(peek M))))F(conj F(- N(M(peek F))))](recur(inc N)M F))(do(prn F)(prn M)))))
```
Simply builds the sequences iteratively up from zero to n.
Ungolfed version
```
(fn [n]
  (loop [N 1 M [0] F [1]]
    (if (< N n)
      (let [M (conj M (- N (F (peek M))))
            F (conj F (- N (M (peek F))))]
        (recur (inc N) M F))
      (do
        (prn F)
        (prn M)))))
```
[Answer]
# Julia, 54 bytes
```
f(n,x=1,y=0)=n>1?f(n-.5,[y;-x[y[k=end]+1]+k],x):[x y]'
```
[Try it online!](http://julia.tryitonline.net/#code=ZihuLHg9MSx5PTApPW4-MT9mKG4tLjUsW3k7LXhbeVtrPWVuZF0rMV0ra10seCk6W3ggeV0nCgoyMHw-Znw-cHJpbnQ&input=)
[Answer]
# Pyth, 24 bytes
It is probably impossible to use `reduce` to reduce the byte-count.
Straightforward implementation.
```
L&b-b'ytbL?b-by'tb1'MQyM
```
[Try it online!](http://pyth.herokuapp.com/?code=L%26b-b%27ytbL%3Fb-by%27tb1%27MQyM&input=10&debug=0)
## How it works
```
L&b-b'ytb  defines a function y, which is actually the male sequence.
L          def male(b):
 &b            if not b: return b
   -b          else: return b-
     'ytb            female(male(b-1))
L?b-by'tb1 defines a function ', which is actually the female sequence.
L          def female(b):
 ?b            if b:
   -by'tb          return b-male(female(b-1))
         1     else: return 1
'MQ        print(female(i) for i from 0 to input)
yMQ        print(male(i) for i from 0 to input)
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 65 bytes
```
:{:1-:0re.}fL:2aw,@Nw,L:3aw
0,1.|:1-:2&:3&:?--.
0.|:1-:3&:2&:?--.
```
My attempt at combining both predicates for male and female into one actually made the code longer.
You could use the following one liner which has the same number of bytes:
```
:{:1-:0re.}fL:{0,1.|:1-:2&:3&:?--.}aw,@Nw,L:{0.|:1-:3&:2&:?--.}aw
```
**Note**: This works with the Prolog transpiler, not the old Java one.
### Explanation
Main predicate:
```
:{:1-:0re.}fL                Build a list L of integers from 0 to Input - 1
             :2aw            Apply predicate 2 to each element of L, write the resulting list
                 ,@Nw        Write a line break
                     ,L:3aw  Apply predicate 3 to each element of L, write the resulting list
```
Predicate 2 (female):
```
0,1.                         If Input = 0, unify Output with 1
    |                        Else
     :1-                     Subtract 1 from Input
        :2&                  Call predicate 2 with Input - 1 as argument
           :3&               Call predicate 3 with the Output of the previous predicate 2
              :?-            Subtract Input from the Output of the previous predicate 3
                 -.          Unify the Output with the opposite of the subtraction
```
Predicate 3 (male):
```
0.                           If Input = 0, unify Output with 0
  |                          Else
   :1-                       Subtract 1 from Input
      :3&                    Call predicate 3 with Input - 1 as argument
         :2&                 Call predicate 2 with the Output of the previous predicate 3
            :?-              Subtract Input from the Output of the previous predicate 3
               -.            Unify the Output with the opposite of the subtraction
```
[Answer]
# Pyth, 23 bytes
```
jCuaG-LHtPs@LGeGr1Q],1Z
```
Try it online: [Demonstration](http://pyth.herokuapp.com/?code=jCuaG-LHtPs%40LGeGr1Q]%2C1Z&input=20&debug=0)
### Explanation:
```
jCuaG-LHtPs@LGeGr1Q],1Z
  u                ],1Z    start with G = [[1, 0]]
                           (this will be the list of F-M pairs)
  u             r1Q        for each H in [1, 2, ..., Q-1]:
              eG              take the last pair of G [F(H-1), M(H-1)]
           @LG                lookup the pairs of these values:
                              [[F(F(H-1)), M(F(H-1))], [F(M(H-1)), M(M(H-1))]]
          s                   join them:
                              [F(F(H-1)), M(F(H-1)), F(M(H-1)), M(M(H-1))]
        tP                    get rid of the first and last element:
                              [M(F(H-1)), F(M(H-1))]
     -LH                      subtract these values from H
                              [H - M(F(H-1)), H - F(M(H-1))]
   aG                         and append this new pair to G
jC                         at the end: zip G and print each list on a line
```
Alternative solution that uses a function instead of reduce (also 23 bytes):
```
L?>b1-LbtPsyMytb,1ZjCyM
```
[Answer]
# Ruby, ~~104~~ ~~92~~ ~~97~~ 82 bytes
```
f=->n,i{n>0?n-f[f[n-1,i],-i]:i>0?1:0}
->n{[1,-1].map{|k|p (0...n).map{|i|f[i,k]}}}
```
**Edit:** `f` and `m` are now one function thanks to [HopefullyHelpful](https://codegolf.stackexchange.com/users/41316/hopefullyhelpful). I changed the second function to print `f` then `m`. The whitespace after `p` is significant, as otherwise the function prints `(0...n)` instead of the result of `map`.
The third function prints first an array of the first n terms of `f`, followed by an array of the first n terms of `m`
These functions are called like this:
```
> f=->n,i{n>0?n-f[f[n-1,i],-i]:i>0?1:0}
> s=->n{[1,-1].map{|k|p (0...n).map{|i|f[i,k]}}}
> s[10]
[1, 1, 2, 2, 3, 3, 4, 5, 5, 6]
[0, 0, 1, 2, 2, 3, 4, 4, 5, 6]
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~45~~ 25 bytes
Anonymous tacit function. Requires `⎕IO←0`, which is standard on many APL systems.
```
1 0∘.{×⍵:⍵-(~⍺)∇⍺∇⍵-1⋄⍺}⍳
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/w0VDB51zNCrPjz9Ue9WKyDW1ah71LtL81FHO5ACk1t1DR91twB5tY96N/9PA2p71NsHMaGr@dB640dtE4G84CBnIBni4Rn8P03BlCtNwdAAAA "APL (Dyalog Unicode) – Try It Online")
This works by combining *F* and *M* into a single dyadic function with a Boolean left argument which selects the function to apply. We use 1 for *F* and 0 for *M* so that we can use this selector as return value for *F* (0) and *M* (0). We then observe that both functions need to call themselves first (on the argument minus one) and then the other function on the result of that, so first we recurse with the given selector and then with the logically negated selector.
`⍳` **ɩ**ndices; zero through argument minus one
`1 0∘.{`…`}` outer (Cartesian) "product" (but with the below function instead of multiplication) using `[1,0]` as left arguments (`⍺`) and the indices as right arguments (`⍵`):
 `×⍵` if the right argument is strictly positive (lit. the sign of the right argument):
  `⍵-1` subtract one from the right argument
  `⍺∇` call self with that as right argument and the left argument as left argument
  `(~⍺)∇` call self with that as right arg and the logical negation of the left arg as left arg
  `⍵-` subtract that from the right argument and return the result
 `⋄` else:
  `⍺` return the left argument
[Answer]
# ES6, ~~89~~ ~~85~~ 83 bytes
2 bytes saved thanks to [@Bálint](https://codegolf.stackexchange.com/users/49709/b%c3%a1lint)
```
x=>{F=[n=1],M=[0];while(n<x){M.push(n-F[M[n-1]]);F.push(n-M[F[n++-1]])}return[F,M]}
```
Naïve implementation.
Explanation:
```
x => {
    F = [n = 1], //female and term number
    M = [0]; //male
    while (n < x) {
        M.push(n - F[M[n - 1]]); //naïve
        F.push(n - M[F[n++ - 1]]); //post-decrement means n++ acts as n in the calculation
    }
    return [F, M];
}
```
[Answer]
## Mathematica, ~~69~~ 62 bytes
*Thanks to Sp3000 for suggesting a functional form which saved 14 bytes.*
```
k_~f~0=1-k
k_~f~n_:=n-f[1-k,f[k,n-1]]
Print/@Array[f,{2,#},0]&
```
This defines a named helper function `f` and then evaluates to an unnamed function which solves the actual task of printing both sequences.
[Answer]
## Perl 5.10, ~~85~~ 80 bytes
Meh, dunno if I have more ideas to golf this down...
```
@a=1;@b=0;for(1..<>-1){push@a,$_-$b[$a[$_-1]];push@b,$_-$a[$b[$_-1]]}say"@a\n@b"
```
[Try it online !](https://ideone.com/pUSp9e)
I had to add `use 5.10.0` on Ideone in order for it to accept the `say` function, but it doesn't count towards the byte count.
It's a naive implementation of the algorithm, `@a` being the "female" list and `@b` the "male" list.
Crossed-out 85 is still 85 ?
[Answer]
# Java, 169 bytes total
```
int f(int n,int i){return n>0?n-f(f(n-1,i),-i):i>0?1:0;}void p(int n,int i){if(n>0)p(n-1,i);System.out.print(i==0?"\n":f(n,i)+" ");}void p(int n){p(n,1);p(0,0);p(n,-1);}
```
# F(), M() 56 bytes
```
int f(int n,int i){
    return n>0?n-f(f(n-1,i),-i):i>0?1:0;
}
```
# recursive-for-loop and printing 77 Bytes
```
void p(int n,int i) {
    if(n>0) {
        p(n-1,i);
    }
    System.out.print(i==0?"\n":f(n,i)+" ");
}
```
# outputting the lists in two different lines 37 Bytes
```
void p(int n) {
    p(n,1);
    p(0,0);
    p(n,-1);
}
```
input : p(`10`)  
output :
```
1 1 2 2 3 3 4 5 5 6 6 7 8 8 9 9 
0 0 1 2 2 3 4 4 5 6 6 7 7 8 9 9
```
[Answer]
# C, 166 Bytes
```
#define P printf
#define L for(i=0;i<a;i++)
f(x);m(x);i;c(a){L P("%d ",f(i));P("\n");L P("%d ",m(i));}f(x){return x==0?1:x-m(f(x-1));}m(x){return x==0?0:x-f(m(x-1));}
```
Usage:
```
main()
{
    c(10);
}
```
Output:
```
1 1 2 2 3 3 4 5 5 6
0 0 1 2 2 3 4 4 5 6
```
Ungolfed (331 Bytes)
```
#include <stdio.h>
int female(int x);
int male(int x);
int i;
int count(a){
    for(i=0;i<a;i++){
        printf("%d ",female(i));
    }
    printf("\n");
    for(i=0;i<a;i++){
        printf("%d ",male(i));
    }
}
int female (int x){
    return x==0?1:x-male(female(x-1));
}
int male(x){
    return x==0?0:x-female(male(x-1));
}
int main()
{
    count(10);
}
```
[Answer]
# [8th](http://8th-dev.com/), 195 bytes
**Code**
```
defer: M
: F dup not if 1 nip else dup n:1- recurse M n:- then ;
( dup not if 0 nip else dup n:1- recurse F n:- then ) is M
: FM n:1- dup ( F . space ) 0 rot loop cr ( M . space ) 0 rot loop cr ;
```
**Usage**
```
ok> 5 FM
1 1 2 2 3 
0 0 1 2 2 
ok> 10 FM
1 1 2 2 3 3 4 5 5 6 
0 0 1 2 2 3 4 4 5 6 
```
**Explanation**
This code uses **recursion** and **deferred** **word** 
`defer: M` - The word `M` is declared to be defined later. This is a ***deferred word***
`: F dup not if 1 nip else dup n:1- recurse M n:- then ;` - Define `F` ***recursively*** to generate female numbers according definition. Please note that `M` has not yet been defined
`( dup not if 0 nip else dup n:1- recurse F n:- then ) is M` - Define `M` ***recursively*** to generate male numbers according definition
`: FM n:1- dup ( F . space ) 0 rot loop cr ( M . space ) 0 rot loop cr ;` - Word used to print sequences of female and male numbers
]