Polynomial series

May 13, 2007

the 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";
   }
Posted by raditha at May 13, 2007 11:42 AM
Your Ad Here

 

Jabber  |  Linux  |  mySQL  |  PHP  |  Java  |  Site Map  |  Wiki

Downloads  |  About  |  Links  |  Contact  |  Home

 

Copyright © Raditha Dissanayake 2003 - 2007

Terms of Use  |  Privacy

 

 

May 2007
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31