Polynomial seriesMay 13, 2007the other day, my post said that some tasks are easier with PHP while others are easier with Java. It's always a matter of choosing the right horse for the right course. Yesterday, I solved problem #14 on Project Euler using a few lines of Java code. Problem number 48 , like problem number 20 is a piece of cake with PHP thanks to the availability of the BCMath routines.
$sum =0;
for($i=1; $i<1001; $i++)
{
$sum = bcadd($sum,bcpow($i,$i));
echo "$i -> $sum\n";
}
|
|



