Very easy, there many similar problems in Project Euler
my algorithm is to take the last ten digits every time you multiply or add two numbers, because the other digits won't affect the answer
Edit: I forgot to mention that i will skip multiples of ten since they will have 10 or more zeros at the end
my code gave me an answer in 1.8 seconds
output:9110846700
<?php
function multiply($a,$b){//multiply two numbers and take only the last ten digits
$c=$a*$b;
return substr($c,-10);
}
function add($a,$b){//add two numbers and take only the last ten digits
$c=$a+$b;
return substr($c,-10);
}
$t1=microtime(true);
$s=0;//sum of last ten digits
for($x=1;$x<1000;$x++){
if($x%10==0){continue;}
$p=1;//product
for($a=0;$a<$x;$a++){
$p=multiply($p,$x);
}
$s=add($s,$p);
}
echo $s;
echo "<br><br>".(microtime(true)-$t1);
?>
btw add me as friend in prject euler:
91920865310012_30465243fa220e4397d3dae974d3f4bf