Nuprl Definition : nim-sum

nim-sum(x;y) ==
  if x=0
  then y
  else if y=0
       then x
       else eval rx = x rem 2 in
            eval qx = x ÷ 2 in
            eval ry = y rem 2 in
            eval qy = y ÷ 2 in
            eval s = nim-sum(qx;qy) in
            eval d = if rx=ry then 0 else 1 in
              (2 * s) + d



Definitions occuring in Statement :  callbyvalue: callbyvalue,  int_eq: if a=b then c else d,  remainder: n rem m,  divide: n ÷ m,  multiply: n * m,  add: n + m,  natural_number: $n
Definitions occuring in definition :  remainder: n rem m,  divide: n ÷ m,  callbyvalue: callbyvalue,  int_eq: if a=b then c else d,  add: n + m,  multiply: n * m,  natural_number: $n
FDL editor aliases :  nim-sum

Latex:
nim-sum(x;y)  ==
    if  x=0
    then  y
    else  if  y=0
              then  x
              else  eval  rx  =  x  rem  2  in
                        eval  qx  =  x  \mdiv{}  2  in
                        eval  ry  =  y  rem  2  in
                        eval  qy  =  y  \mdiv{}  2  in
                        eval  s  =  nim-sum(qx;qy)  in
                        eval  d  =  if  rx=ry  then  0  else  1  in
                            (2  *  s)  +  d



Date html generated: 2018_05_21-PM-09_09_40
Last ObjectModification: 2018_02_12-PM-03_12_40

Theory : general


Home Index