MSN Home  |  My MSN  |  Hotmail
Sign in to Windows Live ID Web Search:   
go to MSNGroups 
Groups Home  |  My Groups  |  Language  |  Help  
 
BC2LCCBC2LCC@groups.msn.com 
  
What's New
  Join Now
  Messages  
  Pictures  
  Calendar  
  Documents  
  Links  
  9449 is Composite  
  9559 is composite  
  9779 is composite  
  Base conversion  
  Pari util.gp  
  Digital Roots  
  Quartic Equ  
  3n^2 -1 not sq  
  3n^2+2 not sq  
  8 divides n^2-1  
  a^n(p-1)-b^n(p-1)  
  x^n+y^n=z^(n+1)  
  5^n + 3 <> 2^m  
  a^2 + b^2 = c^2  
  2^m+1 not prime  
  xdivmxp-r  
  y^2 = px^2 +1  
  8 divides (8x+3)^m + (8y+5)^n  
  2 divides (8x+3)^m+(8*y+5)^n  
  (8x+3)^m + (8y+5)^m<> z^m  
  3^x+5^x - 2 = 11k  
  2^x+5^x - 5 = 7k  
  Number Investigations  
  N^3 + 7 <> K^2  
  n^3 + 4m+3 != k^2  
  N + Reciprocal Recursion  
  Pythag Triples  
  Cont Frac  
  Irrationality proofs  
  (p+1)^p +- p^p  
  Primes of form 4k+3,6k+5,3k+2  
  z-y odd primes divides z+y iff z=y+2  
  Area of Triangle  
  x^(p-1) - y^(p-1) == 0 mod p  
  p^(p+k) + k == 0 mod p+k  
  6 divides n(n+1)(2n+1)  
  2^q + q is prime => 3 div q  
  3n^2+1 = 3x^2  
  x^3 + y^3 = z^4  
  Cubic Equation  
  Prime-Index-Primes  
  Think Clear Puzzle  
  (3^n+1)/2 is prime  
  Primes of form (a^n+b^n)/2  
  Pari Util1  
  Pari Util2  
  Fermat Numbers of order m  
  
  
  Tools  
 

countmatch2(str,match) = \\ Count the number of all occurrences of string match  in string  str.
               {
                 local(lnm,lns,x,c,i);
                 str=Str(str);      \\ This allows leaving quotes off input
                 match=Str(match);
                 c=0;
                 i=0;
                 lns=length(str);
                 lnm=length(match);
                 if(lnm>1,i=1);
                 x=1;
                 while(x<=lns-lnm+1,
                 if(mid(str,x,lnm)==match,c++);
                 x++;
                 );
                 return(c)
               }

diffdigits(n) =  \\ Return 1 if all digits of n are different otherwise return 0
            {
            local(a,i,j,ln,f=1);
            ln = length(Str(n));
            a=eval(Vec(Str(n)));
            for(i=1,ln,
            for(j=1,ln,
            if(i!=j&&a[i]==a[j],f=0);
            );
            );
            f;
            }

digits(n) = \\ The vector of the digits of n
           {
            return(eval(Vec(Str(n))))
           }

droot(n) = \\ the digital root of a number.
           {
           local(x);
           x= n%9;
           if(x>0,return(x),return(9))
           }

exponent(n) = \\ Return the exponent if n is a power
              {
              local(x,ln,j,e=0);
              ln=omega(n);
              x=factor(n);
              e=x[1,2];
              for(j=2,ln,
              if(x[j,2] < e,e=x[j,2])
              );
              return(e)
              }


find(str,match) = \\ Return the position of the first occurrence of string match in string str
                {
                 local(lnm,lns,tstr,vstr,x,j);
                 vstr=Vec(Str(str));
                 match=Str(match);
                 lns=length(str);
                 lnm=length(match);
                 for(x=1,lns-lnm+1,
                  tstr="";
                  for(j=x,x+lnm-1,
                  tstr=concat(tstr,vstr[j]);
                  );
                  if(match==tstr,return(x))
                  );
                  return(0);
               }

 getcodes() = \\ Load Ascii character map for base conversion
  {
  local(j,ct);                \\ vec  ->ascii char
   code = vector(258);        \\ code is global to be called by base(r1,r2,num)
   ct=0;
     for(j=48,57,             \\ 01-10->0123456789
     ct++;
     code[ct] = Strchr(j);
      );

   for(j=97,122,              \\ 11-36->abcdefghijklmnopqrstuvwxyz good to base  36
     ct++;                     \\ Lower case first to be compatible with Lcc
     code[ct] = Strchr(j);
      );

   for(j=65,90,               \\ 37-62->ABCDEFGHIJKLMNOPQRSTUVWXYZ   good to base 62
     ct++;
     code[ct] = Strchr(j);
      );


    for(j=32,47,              \\ 63-76-> !"#$%&'()*+,-./
     ct++;
     code[ct] = Strchr(j);
      );

   for(j=58,64,               \\ 77-83->:;<=>?@
     ct++;
     code[ct] = Strchr(j);
      );

   for(j=91,96,               \\ 84-90->:;<=>?@
     ct++;
     code[ct] = Strchr(j);
      );

   for(j=123,255,             \\ 91-224->special ascii char
     ct++;
     code[ct] = Strchr(j);
      );

     for(j=1,31,              \\ 225-255->special ascii char
     ct++;
     code[ct] = Strchr(j);
      );
     }

getcodes()       \\ This globally loads the ascii tree suited for numbers compression

ifactor(n) = \\ The vector of the integer factors of n with multiplicity.
           {
            local(f,j,k,flist);
            flist=[];
            f=Vec(factor(n));
            for(j=1,length(f[1]),
               for(k = 1,f[2][j],flist = concat(flist,f[1][j])
                );
               );
            return(flist)
           }

ifactord(n) = \\ The vector of the distinct integer factors of n (without multiplicity).
           {
            local(f,j,k,flist);
            flist=[];
            f=Vec(factor(n));
            for(j=1,length(f[1]),
               flist = concat(flist,f[1][j])
                );
            return(flist)
           }

instr(str,match) = \\ Get the position of occurrence of match string in string str.
               {
                 local(lns,lnm,x);
                 str=Str(str);      \\This allows leaving quotes off input
                 match=Str(match);
                 lnm=length(match);
                 lns=length(str);
                 for(x=1,lns-lnm+1,
                 if(mid(str,x,lnm)==match,return(x))
                 )
                }

iscube(n) =
           {
           local(r);
           r = n^(1/3);
           if(floor(r+.5)^3== n,1,0)
           }

isfourth(n) = \\ Return 1 if n is a fourt power
           {
           local(r);
           r = sqrt(sqrt(n));
           if(floor(r+.5)^4== n,1,0)
           }

isinteger(n) =
             {
             if(n==floor(n),return(1),return(0))
             }

issamedr(n) = \\ Return 1 if the factors of n with multiplicity have the same digital root else 0.
            {
            local(f,a,ln,x);
            f=0;
            a=ifactor(n);
            ln=length(a);
            for(x=1,ln-1,
              if(droot(a[x])<>droot(a[x+1]),
                f=1;break));
                 if(f==0&ln>1,return(1),return(0))
            }

 

Notice: Microsoft has no responsibility for the content featured in this group. Click here for more info.
  Try MSN Internet Software for FREE!
    MSN Home  |  My MSN  |  Hotmail  |  Search
Feedback  |  Help  
  ©2005 Microsoft Corporation. All rights reserved.  Legal  Advertise  MSN Privacy