Results 1 to 3 of 3

Thread: [RESOLVED] What's wrong here?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Resolved [RESOLVED] What's wrong here?

    The assignment:

    The prime factors of 13195 are 5, 7, 13 and 29.

    What is the largest prime factor of the number 600851475143 ?
    My code:

    PHP Code:
    <center>

    <?PHP

        
    function isPrime($num) {
            for (
    $i $num-1$i 1$i--)
                if (
    $num $i == 0) return false;
            return 
    true;
        }

        
    $num 600851475143;
        
        for (
    $x $num-1$x $num$x--) 
            if ((
    $num $x == 0) && isPrime($x))
                die(
    strval($x));
    ?>

    </center>
    It just shows a white screen...

    Edit: the &# 37 is a % in my code... not sure why it's doing that
    Last edited by penagate; Jul 20th, 2009 at 12:37 AM. Reason: fixed the % sign!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width