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




 
F param Fn
  if Fn = 0
     1 R
  else
     (Fn-1) nm1
     save Fn
     call F nm1
     result Fr
     save Fr
     call M Fr
     result Mr
     restore Fr
     restore Fn
     (Fn-Mr) R
  endif
  return R
 
M param Mn
  if Mn = 0
     0 R
  else
     (Mn-1) nm1
     save Mn 
     call M nm1
     result Mr
     save Mr
     call F Mr
     result Fr
     restore Mr
     restore Mn
     (Mn-Fr) R
  endif
  return R
 
start
 
 i
 if i <= 19
    call F i
    result res
    " $s res ' '" $s
    + i
    goif
 endif
 $s []
 $s
 
 i
 if i <= 19
    call M i
    result res
    " $s res ' '" $s
    + i
    goif
 endif
 $s []
 