mercoledì 14 aprile 2010

Teoria dei numeri - Numeri di Keith inversi

L'inverso del Repfigit? E' il revRepfigit!

Se i Repfigit sono strani e rari oltre il milione, ancora più strabilianti sono gli inversi. I numeri revRepfigit sono come il 12: la loro sequenza con la stessa tecnica dei Repfigit dà il rovescio di 12 ovvero 21.

Altri revRepfigit sono ad esempio:
12, 24, 36, 48, 52, 71, 341, 682, 1285, 5532, 8166, 17593, 28421, 74733, 90711, 759664, 901921, 1593583, 4808691, 6615651, 6738984, 8366363, 8422611, 26435142, 54734431, 57133931, 79112422, 351247542, 428899438, 489044741, 578989902, 3207761244, 4156222103, 5426705064, 5785766973, 6336657062, 48980740972, 51149725354, 83626284302, 94183600081, 98665175305, 1935391095868, 6002181268035, 6334708806271, 12348924235856, 27488180694681, 76365591939888, 309217509306732, 352062080376812, 714692062325732, 723735537269331, 2437358882180001, 6792079280704301, 62244424802562056, 203414193894268461, 217049132946408803, 415499563488189604, 561624665953167171, ... (Sloane's A097060; A. Vrba, pers. comm., Dec. 28, 2006).

Vedi anche http://mathworld.wolfram.com/KeithNumber.html

Ok. Le congetture da verificare sono almeno due (vedi blog precedente); ma le curiosità sono molte di più.

Ad esempio: esiste una proprietà di qualche tipo che ci permette di dire che un numero intero è Repfigit o un revRepfigit?Al momento occorre farsi la sequenza ... molti studiosi cercano la proprietà.

Seconda curiosità: esiste un modo per contare tali numeri in un intervallo da 1 a N? Una sorta di pi(N)?

Altra curiosità. A che possono servire?.

Nel frattempo che meditate, ho apportato una modifica all'algoritmo già presentato precedentemente in modo da permettere di gestire sia Repfigit che revRepfigit. Ottimizzazioni ulteriori sono possibili: le lascio ai volenterosi!  Se riportate il tutto in linguaggio GMP e usate un bel dual core avete speranze di trovare nuovi record di Repfigit a 34 e oltre cifre ...

/*
*   Keith's numbers Research (Repfigit and RevRepfigit)
*   R. Turco
*   rep=1 if I search Repfigit
*   rep=0 if I search RevRepfigit
*
*/

KNRA(start=10, end=10000000, rep=1)=local();{

 for(i=start,end,
      KNR(i,rep);  
 );

}

KNR(val,rep)=local(value=0,p=0,s="",str="", out="", m=0, j=0, s0=0, s1=0, s2=0, trovato=0); {

 
     s = concat(s,val);      
     m = length(s);
     MyW=Vecsmall(s);
     MyW2=Vecsmall(s);

     v=vector(m);
     v2=vector(m);

     /* Reverse Vector */
     MyW2=RevVect(s,m);
         
     /* I calculate the sums */  
     for( j=1,m,
          v[j] = MyW[j]-48;         
          v2[j] = MyW2[j]-48;
          out = concat( out, v[j] );
          out = concat( out, "," );
          str = concat(str, v2[j]);
          s1 = s1 + v[j];
     );
     out = concat( out, s1 );
     out = concat( out, "," );
     v[1]=s1;

     /*
         I calculate the first value of the vector.
         This is important in the revRepfigit
     */

     value=GetValStr(s,m);

     /* I get the value of the reverse vector */

     s2=GetValStr(str,m);
    
     p=1;

     /* I search the Repfigit */
     if( rep == 1,  

         while( trovato == 0 & s1
            p++;
            if( p>m, p=1;);
            s1 = 0;

            for( j=1,m,
              s1 = s1 + v[j];
            );
            out = concat( out, s1 );
            if( s1 == val, print("Repfigit trovato : ", val, " len : ", m); trovato = 1; print(out););
            if( s1 != val, out = concat( out, "," ););
            v[p] = s1;
            
        );
     );

     /* RevRepfigit */
     if( rep == 0 & (10 < s2) & (value%10)!=0,

         while( trovato == 0 & s1
            p++;
            if( p>m, p=1;);
            s1 = 0;
            for( j=1,m,
              s1 = s1 + v[j];
            );
            out = concat( out, s1 );
            if( s2 == s1, print("revRepfigit trovato : ", val, " len : ", m); trovato = 1; print(out););
            if( s1 != val, out = concat( out, "," ););
            v[p] = s1;      
        );
    );
}

GetValStr(str,len)=local(val=0,weight=0);{
 MyStr=Vecsmall(str);
 weight=len-1;
 for(k=1,len,
         val = (MyStr[k]-48)*(10^(weight)) + val;
         weight--;
 );
 return(val);
}

RevVect(str,len)=local(k=0,j=0);{
     MyWA=Vecsmall(str);
     MyWB=Vecsmall(str);

     k=len;
     j=1;
     while( k>0,
            MyWB[k]=MyWA[j];
            k--;
            j++;
     );
     return(MyWB);
}


Alla prox






0 commenti:

Posta un commento