6 (5 is still calculating)

This commit is contained in:
gnieark 2015-11-14 22:41:37 +01:00
parent 87526928ec
commit 7b6f0aeedb

14
euler6.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/*
* Gnieark's anwser to euler problem 6
* https://projecteuler.net/problem=6
*/
$sumOfTheSquares=0;
for($i=1;$i<101;$i++){
$sumOfTheSquares+=pow($i,2);
}
$sum=0;
for($i=1;$i<101;$i++){
$sum+=$i;
}
echo pow($sum,2) - $sumOfTheSquares;