#! perl -nwa
BEGIN{
  print "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html><head><title>Twin Primes</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
</head><body>
<h1>Twin Primes</h1>
<p>

Twenty pairs of Twin Primes in the neighborhood of each power of two.
The left column gives the exponent of 2, the to the right are positive
and negative deltas to the midpoint of the twin primes.  For example,
2^7-20 +/- 1 (i.e., 128-20-1=107 and 128-20+1=109 are prime).  The
powers of two are consective until about 788.

  </p>
  <p>There is also a more machine readable plain text version at
  <a href=\"twin-primes.txt\">twin-primes.txt</a></p>
  
<table border=\"1\">\n";
}
next unless @F==21;
@B=@F[11..20];@A=@F[1..10];
$x=$F[0];
print "<tr><th rowspan=\"2\">2<sup>$x</sup></th><td><tt>";
for (reverse @A) {
  #print "-";
  print &fcomma($_);
  print " ";
}
print "</tt></td></tr><tr><td><tt>";
for (@B) {
    print "+";

  print &fcomma($_);
  print " ";
}
#print "<td>hi</td></tr>";
print "</tt></td></tr>\n";
END{print "</table><hr>";
print `date`;
print "</body></html>\n";}
sub fcomma {
  my $x=shift;
  #my @S=split//;
  for ($x) {
  s/(\d)(\d\d\d)$/$1,$2/;
  while (s/(\d)(\d\d\d),/$1,$2,/) {
  }
}
  $x;
}

