import java.io.*;
import java.math.*;
//_____________________________________________________________
public class all73
{ 
//_____________________________________________________________
public static final void main(String[] args) throws Exception
{
   all73 bnk = new all73();
   bnk.start(args);
}
//___________________________________________________________________________
void start(String[] args)
{
   StringBuffer buf2 = new StringBuffer();
   StringBuffer buf3 = new StringBuffer();
   int val = 5;
   int thepos = 0;
   if (args.length > 0) thepos = Integer.parseInt(args[0]);
   String[] file2 = getFile("constants2.txt").split("\r\n");
   int[][] out3 = new int[val][100];
  for (int kk = 0; kk < file2.length; kk++)
  {
   byte[] file = file2[kk].getBytes();
   int[][] out2 = new int[val][100];
   for (int max = 0; max < out2.length; max++)
   {
      StringBuffer buf = new StringBuffer();
      for (int j = 0; j < (max+1) * 10; j++)
      {
         buf.append((char)file[j]);
         for (int i = 1; i < out2[0].length; i++)
         {
            BigInteger bg1 = new BigInteger(buf.toString());
            BigInteger bg2 = new BigInteger(Integer.toString(i));
            BigInteger bg3 = new BigInteger("0");
            BigInteger bg4 = bg1.mod(bg2);
            if (bg4.equals(bg3)) 
            {
               out2[max][i]++;
            }
         }
      } 
   }  
   for (int maxs = 0; maxs < out2.length; maxs++)
   {
      int max = (maxs + 1) * 100;
      int maxperc = 0;
      int maxpos = 0;
      int perc73 = 0;
      for (int i = 1; i < out2[0].length; i++)
      {
         double perc = 100.0 * out2[maxs][i] / (max / i);
         int per = (int) perc;
         if (per > maxperc)
         {
            maxperc = per;
            maxpos = i;
         }
         if (i == 73) perc73 = per;
      }
      buf2 = new StringBuffer();
      buf2.append(file2[kk] + "<br><br>");
      buf2.append("<table border='1'>\r\n");
      buf2.append("<tr><th colspan='4'>first 1 to " + Integer.toString(max / 10) + " digits of </th></tr>\r\n");
      buf2.append("<tr><th>divide by</th><th>number evenly divisible by</th><th>should be</th><th>percent</th></tr>\r\n");
      for (int i = 1; i < out2[0].length; i++)
      {
         double perc = 10 * 100.0 * out2[maxs][i] / (max / i);
         int per = (int)perc;
         buf2.append("<tr><td>");
         if (maxpos == i) 
         {
            out3[maxs][i]++;
            System.out.println(maxs + " " + i + " " + per);
         }
         if (maxpos == i) buf2.append("<font size='7' color='red'>");
         buf2.append(i);
         if (maxpos == i) buf2.append("</font>");
         buf2.append("</td><td>" + out2[maxs][i] + "</td><td>" + ((max / i) / 10));
         buf2.append("</td><td>");
         if (maxpos == i) buf2.append("<font size='7' color='red'>");
         buf2.append(per);
         if (maxpos == i) buf2.append("</font>");
         buf2.append("</td></tr>\r\n");
      }
      buf2.append("</table><br><br><br>\r\n");
      if ((maxs == out2.length - 1) & (maxpos == 73))
      {
         buf3.append(buf2.toString());
      }
   }
  }
   System.out.println("-------------------------------------");
   saveFile("all73.htm",buf3.toString(),false);
   for (int i = 0; i < 100; i++)
   {
      System.out.print(i + " ");
      for (int j = 0; j < val; j++)
      {
         if (out3[j][i] > 8) System.out.print("X");
         else System.out.print(".");
         System.out.print(out3[j][i] + " ");
      }
      System.out.println("");
   }
}
//___________________________________________________________________________
public static void saveFile(String file, String str, boolean append) 
{
  try
  {
   BufferedWriter out = new BufferedWriter(new FileWriter(file, append));
   out.write(str);
   out.close();
  }
  catch (Exception e)
  {
   System.out.println(e);
  }
}
//___________________________________________________________________________
public static String getFile(String file) 
{
   StringBuffer buf=new StringBuffer();String str;
  try
  {
   BufferedReader in = new BufferedReader (new FileReader (file));
   while((str=in.readLine())!=null)
   {
      buf.append(str+"\r\n");
   }
   in.close();
  }
  catch (Exception e)
  {
   System.out.println(e);
  }
   return (buf.toString());
}
}//__________________________________________________________________________
