Professional Documents
Culture Documents
1
non è primo. Se il gaussiano di 1/n equivale a n-1, allora n è
primo .
Esempi
T(1/57)=18 (T diverso da 1)
(57-1)/18=3.1111 non intero
allora 57 è composto.
T(1/3337)=1610 (T diverso da 1)
(3337-1)/1610=2.0720496 etc
allora 3337 è composto.
1/N=0.000659195781147000659195781147
GCD(1517,10^3-1)=37=p
GCD(1517,10^5-1)=41=q
Allora N=1517=37*41.
Controprova
Facciamo la contro-prova del metodo di sopra. Sappiamo che
N=1517=37*41.
(10^k1-1)/p=3
(10^k2-1)/q=5
T(p) = ag e T(q) = bg
ed in conclusione:
p = GCD [ N, 10^ag - 1 ]
q = GCD [ N, 10^bg - 1 ]
p = GCD [ N, B^ag - 1 ]
3
q = GCD [ N, B^bg - 1 ]
Difficoltà superabili
1. In PARI/GP non esiste una funzione predefinita (built-in) che
individua il periodo: occorre scrivere un algoritmo per T(1/N);
2. Non sempre la frazione è periodica;
3. Per N grande, PARI/GP restituisce il valore in notazione
esponenziale (esempio di notazione esponenziale: 23 E-21)
[4,1,1,2,1,8,1,1,2,1,8,1, ]
4
Esaminiamo N = 66167 T(66167)=1092. La fattorizzazione di 1092 =
2*2*3*7*13.
Da qui:
GCD[66167,10^(21*2)-1] = 127
GCD[66167,10^(26*2)-1] = 521
GCD[57,10^(6)-1] = 3
x 2 + ax - b = 0
Si può riscrivere come:
x(x + a) = b
b b
x= x a
a+x x
5
b b
a
b b
a+ -a+
b b
a+ -a+
a+... -a+...
/*
* Period of a fraction with
* gaussian function
*
*
*/
GaussN(n)= local(g=0, r=1); {
while( g == 0 | r != 1,
r = Mod(( 10 * r), n);
g = g + 1;
);
return(g);
/*
* IsComposite ?
* -1 Boh
* 1 Yes
* 0 No (it's a prime number)
*
*
*/
isCompN(n)= local(g=0, status=-1); {
if( g == n-1,
status=0;
print("No, it's a prime number!");
return(status);
);
if( g != 1,
if( frac((n-1)/g) != 0.0, status = 1;);
);
6
if( status == 1, print("Yes, it's a composite number!"););
return(status);
/*
* IsMyPrime ?
* 1 Yes
* 0 No
*
*
*/
isMyPrime(n)= local(status=0); {
7
This document was created with Win2PDF available at http://www.win2pdf.com.
The unregistered version of Win2PDF is for evaluation or non-commercial use only.