Code
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Lucas Numbers</title>
</head>
<body>
<table style="border-width: thin; border-color: blue;">
<tr>
<td style="width: 50px; ">Number</td><td style="Width:200px;">Lucas</td><td style="Width:200px;">Fibonacci</td>
<td style="Width:200px;">Sum</td><td style="Width:150px;">Difference</td><td style="Width:150px;">Lucas/Fibonacci</td>
<td style="Width:150px;">Fibonacci/Lucas</td>
</tr>
<tr>
<td>1</td><td>1</td><td>1</td><td>2</td><td>0</td><td>1</td><td>1</td>
</tr>
<tr>
<td>2</td><td>3</td><td>1</td><td>4</td><td>2</td><td>3</td><td>.333333333333333</td>
</tr>
<?php
$lucas[0] = 1;
$lucas[1] = 3;
$fib[0] = 1;
$fib[1] = 1;
$precision = 20;
for ($i = 2; $i<=200; $i++) {
$lucas[$i] = $lucas[$i- '1'] + $lucas[$i-'2'];
$fib[$i] = $fib[$i- '1'] + $fib[$i- '2'];
echo " <tr> <td>";
echo $i+'1';
echo " </td><td>";
echo $lucas[$i];
echo " </td><td>";
echo $fib[$i];
echo " </td><td>";
echo bcadd($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcsub($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcdiv($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcdiv($fib[$i],$lucas[$i], $precision);
echo "</td></tr>";
}
?>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Lucas Numbers</title>
</head>
<body>
<table style="border-width: thin; border-color: blue;">
<tr>
<td style="width: 50px; ">Number</td><td style="Width:200px;">Lucas</td><td style="Width:200px;">Fibonacci</td>
<td style="Width:200px;">Sum</td><td style="Width:150px;">Difference</td><td style="Width:150px;">Lucas/Fibonacci</td>
<td style="Width:150px;">Fibonacci/Lucas</td>
</tr>
<tr>
<td>1</td><td>1</td><td>1</td><td>2</td><td>0</td><td>1</td><td>1</td>
</tr>
<tr>
<td>2</td><td>3</td><td>1</td><td>4</td><td>2</td><td>3</td><td>.333333333333333</td>
</tr>
<?php
$lucas[0] = 1;
$lucas[1] = 3;
$fib[0] = 1;
$fib[1] = 1;
$precision = 20;
for ($i = 2; $i<=200; $i++) {
$lucas[$i] = $lucas[$i- '1'] + $lucas[$i-'2'];
$fib[$i] = $fib[$i- '1'] + $fib[$i- '2'];
echo " <tr> <td>";
echo $i+'1';
echo " </td><td>";
echo $lucas[$i];
echo " </td><td>";
echo $fib[$i];
echo " </td><td>";
echo bcadd($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcsub($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcdiv($lucas[$i],$fib[$i], $precision);
echo " </td><td>";
echo bcdiv($fib[$i],$lucas[$i], $precision);
echo "</td></tr>";
}
?>
</table>
</body>
</html>
This chart is supposed to show the # in both sequences, Fibonacci value, Lucas Value, their Sum, their Difference, Lucas Divided by Fibonacci, and Fibonacci divided by Lucas, in that order as a table. You can see what happened at:http://www.centreri.net/Experimentation.php. Got really ugly. I originally tried using normal +/-///* functions, but it didn't have the proper accuracy and started transforming actual values into more managable versions, so I switched to BCmath functions, which I heard from someone is just what I need. So... It thinks 1.54800875592E+12 divided by 3.461452808E+12 is zero, causing errors there. It thinks vice versa of that is same.
It doesn't do addition/subtraction beyond the 60'th value. In short, it's an unreiable disaster in which it's impossible to check consistancy of patterns, all that. Not that this exact script needs to do it, but since I'll be running tests on these values, I need these functions to work properly. Also, it's not vital, but if there's an easy way to make the precision of the functions affect the numbers only if there's more numbers than it would normally show, rather then adding .0000000000, that would be great.
Thank you in advance. Oh, and I know the coding isn't optimal, but I was in a hurry. I posted it here because I've gotten largely more useful responses from here than on coding sites, like Codedfx.com or phpbuilder.com. Doodle, hope you're there.
None.