1. <small id='vhWs3'></small><noframes id='vhWs3'>

      <i id='vhWs3'><tr id='vhWs3'><dt id='vhWs3'><q id='vhWs3'><span id='vhWs3'><b id='vhWs3'><form id='vhWs3'><ins id='vhWs3'></ins><ul id='vhWs3'></ul><sub id='vhWs3'></sub></form><legend id='vhWs3'></legend><bdo id='vhWs3'><pre id='vhWs3'><center id='vhWs3'></center></pre></bdo></b><th id='vhWs3'></th></span></q></dt></tr></i><div id='vhWs3'><tfoot id='vhWs3'></tfoot><dl id='vhWs3'><fieldset id='vhWs3'></fieldset></dl></div>

      • <bdo id='vhWs3'></bdo><ul id='vhWs3'></ul>
    2. <tfoot id='vhWs3'></tfoot>

      1. <legend id='vhWs3'><style id='vhWs3'><dir id='vhWs3'><q id='vhWs3'></q></dir></style></legend>

        如何乘数直到达到个位数并计算数字?

        时间:2023-09-21
          <tbody id='qGpoB'></tbody>

          <legend id='qGpoB'><style id='qGpoB'><dir id='qGpoB'><q id='qGpoB'></q></dir></style></legend>
          • <bdo id='qGpoB'></bdo><ul id='qGpoB'></ul>

                  <i id='qGpoB'><tr id='qGpoB'><dt id='qGpoB'><q id='qGpoB'><span id='qGpoB'><b id='qGpoB'><form id='qGpoB'><ins id='qGpoB'></ins><ul id='qGpoB'></ul><sub id='qGpoB'></sub></form><legend id='qGpoB'></legend><bdo id='qGpoB'><pre id='qGpoB'><center id='qGpoB'></center></pre></bdo></b><th id='qGpoB'></th></span></q></dt></tr></i><div id='qGpoB'><tfoot id='qGpoB'></tfoot><dl id='qGpoB'><fieldset id='qGpoB'></fieldset></dl></div>
                1. <small id='qGpoB'></small><noframes id='qGpoB'>

                  <tfoot id='qGpoB'></tfoot>
                  本文介绍了如何乘数直到达到个位数并计算数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  它的描述是这样的:

                  persistence(39) == 3 // because 3*9 = 27, 2*7 = 14, 1*4=4
                  // and 4 has only one digit
                  
                  persistence(999) == 4 // because 9*9*9 = 729, 7*2*9 = 126,
                  // 1*2*6 = 12, and finally 1*2 = 2
                  
                  persistence(4) == 0 // because 4 is already a one-digit number
                  

                  我只能这样:

                  $array = str_split(39);
                  
                      foreach ($array as $key => $value) {
                          echo $array[$key]*$array[$key+1];
                      }
                  

                  接下来我就糊涂了

                  有什么解决方案可以解决我的问题?

                  Any solution to solve my problem?

                  推荐答案

                  $array = str_split('999'); //Your string
                  $j=0; //Counter for counting the number of iteration
                  while (count($array)>1){ //When more than 2 indexes in array
                   for($i=0;$i<count($array);$i++){ //Iterate through all permutations
                       $array = array_product($array); //Multiplies all numbers in array
                       $array = str_split($array); //Split the array up again
                       $j++; //Increment counter(as literal as I can sound)
                   }
                  }
                  echo $j; //Print out the number of times
                  

                  这篇关于如何乘数直到达到个位数并计算数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:php - foreach - 通过键名获取具体数据 下一篇:迭代来自 preg_match_all 的匹配项

                  相关文章

                  最新文章

                    <bdo id='22U7t'></bdo><ul id='22U7t'></ul>
                    <i id='22U7t'><tr id='22U7t'><dt id='22U7t'><q id='22U7t'><span id='22U7t'><b id='22U7t'><form id='22U7t'><ins id='22U7t'></ins><ul id='22U7t'></ul><sub id='22U7t'></sub></form><legend id='22U7t'></legend><bdo id='22U7t'><pre id='22U7t'><center id='22U7t'></center></pre></bdo></b><th id='22U7t'></th></span></q></dt></tr></i><div id='22U7t'><tfoot id='22U7t'></tfoot><dl id='22U7t'><fieldset id='22U7t'></fieldset></dl></div>

                      <small id='22U7t'></small><noframes id='22U7t'>

                    1. <tfoot id='22U7t'></tfoot>

                      <legend id='22U7t'><style id='22U7t'><dir id='22U7t'><q id='22U7t'></q></dir></style></legend>