5 the number of samples to achieve PHPH daffodils

It refers to a number of n bits daffodils (n≥3), on which digital bits of each n-th power sum is equal to itself. (For example: 1 ^ 3 ^ 3 + 3 + 5 ^ 3 = 153)

method one,

<?php
for($q=1;$q<=9;$q++){
    for($w=0;$w<=9;$w++){
      for($e=0;$e<=9;$e++){
        if($q*$q*$q + $w*$w*$w + $e*$e*$e ==
        100*$q + 10*$w + $e){
          echo "$q $w $e "."<p>";
        }
      }
    }
}
?>

Method Two,

? <PHP
function Cube (n-$)
{
    return $ * $ n-n-n-* $;
}
 
function is_narcissistic (n-$)
{
    $ Hundreds = Floor (n-$ / 100); // decompose one hundred
    $ tens = floor ( $ n / 10)% 10; // decomposition ten
    $ ones = floor ($ n% 10); // decomposition bits
    return (bool) (cube ($ hundreds) + cube ($ tens) + cube ( ones $) n-== $);
}
 
 
for (I = $ 100; $ I <1000; $ I ++)
{
    IF (is_narcissistic (I $))
        . I echo $ "\ n-";
}
?>

Method three,

? <PHP
// Armstrong number: the number of bits a k, k-th power of its digital bits on each and equal to itself. (E.g.,:. 1 ^. 3 +. 5 ^. 3 +. 3 ^. 3 = 153)
class Armstrong {
 static function index () {
  for ($ I = 100; $ I <100000; $ I ++) {
  echo Self :: is_armstrong ($ I ?.) I $ '<br>': '';
  }
 }
 static function is_armstrong ($ NUM) {
  $ S = 0;
  $ K = strlen ($ NUM);
  $ D = str_split ($ NUM);
  the foreach ($ R & lt AS $ D) {
  $ bcpow = S + (R & lt $, $ K);
  }
  return $ NUM == $ S;
 }
}
Armstrong :: index ();

Method IV,

<HTML>
 
<head>
  <title> </ title>
</ head>
 
<body>
 
<? PHP
 
 function Winter ($ NUM)
 {
      IF ($ NUM <1000) {
      // definition of bits
      $ ge = $ num% 10 ;
      // definition of ten
      $ ten = (($ 100 NUM%) - $ GE) / 10;
      // define one hundred
      / * floor rounding, all digits after the decimal point is ignored * /
      $ hundred = Floor ($ NUM / 100);
      $ SUM1 = $ GE * $ GE * $ GE + $ Ten * $ Ten * $ Ten + $ Hundred * $ Hundred * $ Hundred;
      IF ($ SUM1 == $ NUM) {
              return. 1;
                } the else {
                        return 0;
                        }
 
              } the else {
                      return -1;
                      }
        }
 
        if(winter(371)==-1) {
                echo "大于1000的数";
            }else{
                  if(winter(371)) {
                          echo "Yes";
                          }
    else{
  echo "No";
  }
        }
 
?>
 
</body>
</html>

Method five,

<? PHP
header ( 'Content-type: text / HTML; charset = UTF8');
 ?>
 <Script>
for (var I = 100; I <1000; I ++) {
    A = the parseInt (I% 10); // decomposition of bits
    b = parseInt (i / 10% 10); // decomposition ten
    c = parseInt (i / 100% 10); // decompose one hundred
    if (c * c * c + b * b * * A * A + B A == I) {
        document.write (I + "<br>");
    }
}
 </ Script>

Guess you like

Origin www.linuxidc.com/Linux/2019-07/159583.htm