Project Euler 16


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. //project euler 16
  3. //by cobra90nj
  4.  
  5. $pot = bcpow(2,1000);
  6. $loop = $sum = 0;
  7. $strpot = strlen($pot);
  8.  
  9. while ($loop < $strpot) {
  10. $sum += $pot{$loop};
  11. $loop++;
  12. }
  13.  
  14. echo $sum;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.