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 {\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).




 
see "F sequence : "
for i = 0 to 20
    see "" + f(i) + " "
next 
see nl
see "M sequence : "
for i = 0 to 20
    see "" + m(i) + " "
next
 
func f n
     fr = 1
     if n != 0 fr = n - m(f(n - 1)) ok
     return fr
 
func m n
     mr = 0
     if n != 0 mr = n - f(m(n - 1)) ok
     return mr
 