Created
October 30, 2013 13:13
-
-
Save kazua/7232451 to your computer and use it in GitHub Desktop.
Project Euler Problem 20(PHP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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