View Single Post
Old 05-28-2003, 04:52 PM  
kevinale
Confirmed User
 
Join Date: Dec 2002
Location: Austin, TX
Posts: 2,115
I wrote a PERL program to figure it out for me. My g/f used Excel. Here is my code:

<pre>

for($n=100;$n<999;++$n) {
print "$n \n";
if(allEven($n) && allEven($n+500)){
print "\n\nI GOT IT! THE # is -> $n\n\n";
exit(1);
}
}

sub allEven{
$num1 = shift;
$num = "" . $num1**2;
$retVal = 1;
for($i=0; $i<length($num);++$i){
# print " TRYING $num length = " . length($num);
$k = substr($num,$i,1);
if($k%2 hahahaha 0){
$retVal &= 1;
}
else{
$retVal = 0;
}
}

return $retVal;

}

</pre>
__________________
1monkey0cup.com
kevinale is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote