user
Two functions are said to be mutually recursive if the first calls the second,
and in turn the second calls the first.

Write two mutually recursive functions that compute members of the Hofstadter Female and Male sequences defined as:

:   F
    (
    0
    )


    =
    1
     
    ;
     
    M
    (
    0
    )
    =
    0


    F
    (
    n
    )


    =
    n
    −
    M
    (
    F
    (
    n
    −
    1
    )
    )
    ,

    n
    >
    0


    M
    (
    n
    )


    =
    n
    −
    F
    (
    M
    (
    n
    −
    1
    )
    )
    ,

    n
    >
    0.
    {\displaystyle {\displaystyle {\begin{aligned}F(0)&=1\ ;\ M(0)=0\\F(n)&=n-M(F(n-1)),\quad n>0\\M(n)&=n-F(M(n-1)),\quad n>0.\end{aligned}}}}

(If a language does not allow for a solution using mutually recursive functions
then state this rather than give a solution by other means).
assistant
(formerly Perl 6)
A direct translation of the definitions of 

F
{\displaystyle {\displaystyle F}}
 and 

M
{\displaystyle {\displaystyle M}}
:

```
multi F(0) { 1 }; multi M(0) { 0 }
multi F(\𝑛) { 𝑛 - M(F(𝑛 - 1)) }
multi M(\𝑛) { 𝑛 - F(M(𝑛 - 1)) }

say map &F, ^20;
say map &M, ^20;

```

Output:

```
1 1 2 2 3 3 4 5 5 6 6 7 8 8 9 9 10 11 11 12
0 0 1 2 2 3 4 4 5 6 6 7 7 8 9 9 10 11 11 12

```