<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
<!--
 * Started on March 10, 2006
 *
 *  This is a .php webpage/script for accessing the mysql database abc to get
 *  good abc triples.
 *
-->
 <head>
 
 <meta name= "author" content = "Chris Hurlburt" />
 <meta name= "keywords" content = "abc triples, number theory" />
 <meta name= "description" content = "Access to a database containing all good abc triples with small c values." />
 
<link rel="stylesheet" type="text/css" href="abcindex.css" />

 <title>Good abc Triple Database Access</title>
 </head>
 
 <body>
 
 
 <div id="container">
 	
 	<div id = "intro">
 
	 	<div id="pageHeader">
 		<h1><span>
 		<!--
 		/*<a title="A database of good abc triples" href="abc.html">Good abc Triples</a> */
 		-->
 		Good abc Triples 
   		</span></h1>
   		</div>

		<div id = "quickSummary">
		<p> <span> Query a database containing all good abc triples whose <i>c</i> value 
		is less than or equal to <i>10<sup>8</sup></i>.
		</span></p>
		</div>
	</div>
	
		
	
 	<div id="database">
 		<h3 class="ftype"><span>Query the database:</span></h3>
 		<div id = "accessForm">
			<form action = "<?php echo $_SERVER['PHP_SELF'];?>" method = "post">
			<p>
			<select  name = "columnvalue">
				<option value = "cvalue">c</option>		
				<option value = "all">a, b, or c</option>		
				<option value = "avalue">a</option>
				<option value = "bvalue">b</option>
			</select>
			is
			<select  name = "operation">
				<option value = " = "> = </option>
				<option value = " < "> &#60 </option>
				<option value = " > "> &#62 </option> 
			</select>
			the number
			<input type = "text" name = "searchnumber" value = "" size = "10"/>
			</p>
			<input type = "checkbox" name = "singleline" /> Display results as a single line. <br />
			<input type = "submit" name = "submit" value = "search" />
			<br />
			</form>		
 		</div>
 		
 		<div id = "results">
 			<?php 
 
				if (isset($_POST['submit']))
 				{
 
   					/*Open the database for the Mathematics database*/
 					include "mysql.connect.php";
 					
 					/*Get the variables from the form---note most are in the necessary format for mysql queries. */
					$querycolumn = $_POST['columnvalue'];
					$queryop = $_POST['operation'];					
			 		$queryvalue = $_POST['searchnumber'];
			 		
			 		/*Put together the conditions for the query. */
			 		if ($querycolumn == "all")
			 		{
			 			$condition = '(avalue '.$queryop .$queryvalue .') OR (bvalue '.$queryop .$queryvalue .') OR (cvalue '.$queryop .$queryvalue .')';
			 		}
			 		else
			 		{
			 			$condition = $querycolumn .$queryop  .$queryvalue ;
			 		}
			 		
			 		/* This line is to check if the condition part is putting together a correct 
			 		*statement to be used as part of the WHERE clause of a mysql query.
				 	*	echo $condition . "<br />" ;
 					*
 					*/
 					 
 					/*Query the database! */ 
			 		$query = "SELECT * FROM `abc` WHERE $condition ";
					$result = mysql_query($query);
				
					/*Display the results */
					if ($_POST['singleline'])
					{
						while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
 						{
 							$aval = $row['avalue'];
 							$bval = $row['bvalue'];
 							$cval = $row['cvalue'];
 							echo "($aval, $bval, $cval), ";
						}
						echo "<br />";
					}
					else
					{
						while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
 						{
 							$aval = $row['avalue'];
 							$bval = $row['bvalue'];
 							$cval = $row['cvalue'];
 							echo "($aval, $bval, $cval) <br />";
 						}
					}
					mysql_close();
 				}
			?> 		
 		</div> 	
 	</div>
 	
 	
 	<div id="supportingText">
 	
	

 		<div id="definition">
 			<h3 class="dtype"><span>Definition of a Good abc Triple:</span></h3>
 			<p><span> A good abc triple is  a set of 3 positive 
 			integers <i>a</i>, <i>b</i>, <i>c</i> such that
 				<ol>
 					<li><span> <i>a + b = c</i> </span></li>
 					<li><span> <i>gcd(a,b,c) = 1</i> </span></li>
 					<li><span> <i>c &#62 rad(abc)</i> </span></li>	
 				</ol>
 			where <i>rad(n)</i>	is the product of all primes dividing <i>n</i> for <i>n</i> a 
 			positive integer.
 			</span></p>
 			<p><span>
 			The ratio of a good abc triple is simply <i>log(c)/log(rad(abc))</i>.  A good abc example 
 			usually means a good abc triple whose ratio is greater than 1.4.
 			</span></p>
 		</div>
 		
 		<div id="links">
	 		<h3 class="ltype"><span>Links:</span></h3>
 			<ul>
 				<li> <a href = "http://modular.ucsd.edu/sage/">SAGE </a>
 				</li>
 				<li> <a href = "http://www.math.unicaen.fr/~nitaj/abc.html">ABC Conjecture Homepage </a>
 				</li> 
 				<li> <a href = "http://www.minet.uni-jena.de/~aros/abc.html">Good ABC - ratios </a>
 				</li> 
 			</ul>
 		</div>
 		
 		
  	
   		<div id="about">
 			<h3 class="atype"><span>About the database:</span></h3>
 			<p><span> The database contains all good abc triples with <i>c</i> value less
 			than or equal to <i>10<sup>8</sup></i>.  The data is stored in a MySQL database 
 			and was generated using Python script files for SAGE.
 			<! --- in the database was generated using 
 			Python script files for SAGE.  The current script file takes approximately 10 
 			hours of cpu time on a Macintosh G4 to generate the data which is stored in a 
 			MySql database. ---!>
 			</span></p>
 		</div>
		
		
 	

	</div> 	
 	 
 </div>
 </body>
</html>
