Skip to content

Instantly share code, notes, and snippets.

@kazua
Created October 30, 2013 13:13
Show Gist options
  • Save kazua/7232451 to your computer and use it in GitHub Desktop.
Save kazua/7232451 to your computer and use it in GitHub Desktop.
Project Euler Problem 20(PHP)
<?php
//http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2020
//write kazua
function array_bcproduct($a) {
$r = "1";
foreach ($a as $v)
$r = bcmul($r, $v);
return $r;
}
echo array_sum(str_split(array_bcproduct(range(1, 100))));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment