歌德巴赫猜想 1+1

<?php
//////////////////////////////////////
//Goldbach Guess        //
//Ver: 0.1a                            //
//Last Edit: 01-01-2001                //
//Author: Frank Liu                    //
//E-mail: [email protected]    //
//////////////////////////////////////
function getmicrotime() {
    list(
$usec,$sec)=explode(" ",microtime());
    return ((float)
$usec+(float)$sec);
}

function 
primenumber($range,$column) {
    
$times=getmicrotime();
    
$prime=array();
    
$tp=0;
    
$col=1;
    echo 
"<h3>Goldbach Guess 1+1</h3>\n";
    echo 
"<b>List of prime numbers <= $range:</b><hr>\n<table width=\"100%\">\n";
    for (
$i=1;$i<=$range;$i++) {
        
$o="";
        
$cen=$i%2;
        if (
$cen!="0"){
            
reset($prime);
            
$mdpn=$i/3+1;
            
$mdpn=ceil($mdpn);
            while (list (
$eps$dpn) = each ($prime)){
                if (
$dpn>&& $dpn<$mdpn) {
                    
$r=$i%$dpn;
                    
$tp++;
                    if (
$r==0) {
                        
$o="no";
                        break;
                    }
                }
            }
        }
        elseif(
$i>2) {
            
$o="no";
        }
        if (
$o!="no"){
            if (
$col==1) {
                echo 
"<tr>\n";
            }
            
array_push($prime,$i);
            echo 
"<td> $i </td>\n";
            if (
$col==$column){
                
$col=0;
                echo 
"</tr>\n";
            }
            
$col++;
        }
    }
    echo 
"</table>\n<hr><hr>\n";
    echo 
"<b>Now showing the even numbers constructed by two prime numbers which are <= $range:</b><hr>\n<table width=\"100%\">\n";
    
$ane=count($prime)+1;
    for (
$f=0;$f<$ane;$f++) {
        for (
$s=0;$s<$ane;$s++) {
            
$res=$prime[$f]+$prime[$s];
            
$rr=$res%2;
            if (
$rr == && $res != && !$wow[$res]) {
                
$wow[$res]=$prime[$f]."+".$prime[$s];
            }
            
$tp++;
        }
    }
    
ksort($wow);
    
end($wow);
    
$mpn=current($wow);
    
reset ($wow);
    
$enc="2";
    
$col=1;
    
$joe=0;
    while (list (
$key$val) = each ($wow)) {
        if (
$col==1) {
            echo 
"<tr>\n";
        }
        while (
$enc $key) {
            
$sta="Possible!";
            if (
$enc<$mpn) {
                
$sta="DEAD!";
            }
            echo 
"<td><font color=red> <b>$enc $sta</b> </font></td>\n";
            if (
$col==$column){
                
$col=0;
                echo 
"</tr>\n";
            }
            
$col++;
            
$enc+=2;
            
$joe++;
        }
        
$tp++;
        echo 
"<td> <b>$key</b> = $val </td>\n";
        
$enc+=2;
        if (
$col==$column){
            
$col=0;
            echo 
"</tr>\n";
        }
        
$col++;
    }
    
$tp=$tp+$joe;
    
$timee=getmicrotime();
    
$timespan=$timee-$times;
    
$timespan=round($timespan,6);
    echo 
"</table>\n<hr><hr>\nTotal Proccess: <font color=red>$tp</font> / \nTime Spent: <font color=red>$timespan</font> Sec / Total Unresolved: <font color=red>$joe</font> numbers /  Written by Frank Liu / 09-04-2001";
}
primenumber(10000,5);
?>