// download 1 billion digits of pi here:
// https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt
//_____________________________________________________________
public class pioffset
{ 
   //byte[] file = data.getBytes("pi-billion.txt");
   byte[] file = data.getBytes("pi.dec");
   // BRAJYO BRA ALHYM AO HJMYM VAO HARE
//_____________________________________________________________
public static final void main(String[] args) throws Exception
{
   pioffset bnk = new pioffset();
   bnk.start();
}
//___________________________________________________________________________
void start()
{
   System.out.println("This proves pattern 91");
   startit(970990704,1,1,1);
   startit(351483,1,2,1);
   startit(16244873,2,1,1);
   startit(491764,2,2,1);

   startit(4226340,1,1,2);
   startit(21277083,1,2,2);
   startit(2478918,2,1,2);
}
//___________________________________________________________________________
boolean startit(int offset, int type1, int type2, int type3)
{
   int[] args = {913,203,86,401,395,407,296};
   int[] args2 = {76,23,41,23,62,29,44};
   String argsn = "4555828";
   if (type3 == 2) argsn = "6352534";
   int pos = 0;
   String out = "";
   int val = 0;
   int j = offset - 1;
   out = "";
   pos = 0;
   StringBuffer buf = new StringBuffer();
   for (int i = 0; i < args.length; i++)
   {
      if (type1 == 1) val = args[i]; else val = args2[i];
      if (type2 == 1) pos += val; else pos = val;
      buf.append((char)file[pos + j]);     
   }
   boolean ok = buf.toString().equals(argsn); 
   System.out.println (offset + " " + type1 + " " + type2 + " " + buf.toString() + " " + ok);
   if (ok) return(true);
   return(false);
}
}//__________________________________________________________________________
