Project Euler.net Answers
Problem 4
Solved on 2/26/2008
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Product1:913Product2:993
Answer: 906,609
$answer = 0;
for($oc = 999; $oc>1; $oc--){
for($ic = 999; $ic>1; $ic--){
if($this->isPal($ic*$oc)){
if($ic*$oc > $answer){
$answer = $ic*$oc;
$p1 = $ic;
$p2 = $oc;
}
}
}
}
public function isPal($val){
$rev = strrev($val);
if(strlen($val) % 2 == 0){
$length = strlen($val)/2;
return (substr($val,0,$length) == substr($rev,0,$length));
}else{
$length = (strlen($val)-1)/2;
return (substr($val,0,$length) == substr($rev,0,$length));
}
}
Feb. 11, 2008
Wells Ideas Inc. launches their redesigned site.
The site is built on a symfony platform and utilizes client information from their project management site.
Wells Ideas Inc. launches their redesigned site.
The site is built on a symfony platform and utilizes client information from their project management site.
"The greatest challenge to any thinker is stating the problem in a way that will allow a solution."
- Bertrand Russell
- Bertrand Russell
Wells Ideas © 2007 | 1-973-769-9108 | info@wellsideas.com
Contact Us | Site Map | Open Source Solutions | Templates | Client Login
Contact Us | Site Map | Open Source Solutions | Templates | Client Login
