User Profile

Collapse

Profile Sidebar

Collapse
mwesolow
mwesolow
Last Activity: May 8 '10, 07:25 PM
Joined: Apr 27 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • mwesolow
    replied to Palindrome Question
    in Perl
    nevermind, got it :D

    Code:
    for ($j = "100"; $j <= "999"; $j += 1){
     for($i = "100"; $i <= $j; $i += 1){
      if(isPalindrome($i*$j) and $i*$j > $l*$p){
        $l=$i;
        $p=$j;
      }
     }
    }
    print STDOUT ($l*$p)." Is a product of two three-digit integers and a palindrome.\n";
    print STDOUT "($l,$p)";
    
    sub isPalindrome
    ...
    See more | Go to post

    Leave a comment:


  • mwesolow
    replied to Palindrome Question
    in Perl
    Thanks! That worked perfectly. Now I have to figure out why the largest one it gives is 580085 = 583 * 995, when the solution is apparently 906609
    See more | Go to post

    Leave a comment:


  • mwesolow
    started a topic Palindrome Question
    in Perl

    Palindrome Question

    Hello,

    I'm having trouble getting my code to work. It seems that my function isPalindrome works correctly when I just test it out on some particular products of 3-digit integers, but when I use it in my full program, it fails to do its job.

    Here's my code:

    Code:
    for ($j = "100"; $j <= "110"; $j += 1){
     for($i = "100"; $i <= $j; $i += 1){
      if(isPalindrome($i*$j)){
    ...
    See more | Go to post
No activity results to display
Show More
Working...