Home > php教程 > PHP源码 > body text

Ack函数,php

WBOY
Release: 2016-06-08 17:31:39
Original
1467 people have browsed it
<script>ec(2);</script>




function Ack($m,$n)
{
   if($m==0)
   {
      return $n+1;
   }
    else
   {
     if($n==0)
     {
       return Ack($m-1,1);
     }
       else
     {
      return Ack($m-1,Ack($m,$n-1));
     }
   }
}
//--------------------------------------//
for($i=0;$i{
    for($j=0;$j    {
        printf("-%5d-",Ack($i,$j));
    }
       printf("n");
}
?>


-    1--    2--    3-
-    2--    3--    4-
-    3--    5--    7-

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template