Różnica pomiędzy stronami "Liczby kwadratowe i niekwadratowe modulo. Wybrane zagadnienia" i "Testy pierwszości. Liczby pseudopierwsze Lucasa i liczby silnie pseudopierwsze Lucasa. Test BPSW"

Z Henryk Dąbrowski
(Różnica między stronami)
Przejdź do nawigacji Przejdź do wyszukiwania
 
 
Linia 1: Linia 1:
<div style="text-align:right; font-size: 130%; font-style: italic; font-weight: bold;">22.04.2023</div>
+
<div style="text-align:right; font-size: 130%; font-style: italic; font-weight: bold;">11.01.2023</div>
  
 
__FORCETOC__
 
__FORCETOC__
Linia 5: Linia 5:
  
  
== Element odwrotny modulo <math>m</math> ==  
+
== Ciągi Lucasa ==
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K1</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Definicja M1</span><br/>
Niech <math>m \in \mathbb{Z}_+</math>. Dla liczby <math>k</math> istnieje taka liczba <math>x</math>, że
+
Niech <math>P, Q \in \mathbb{Z} \setminus \{0\}</math> oraz <math>D = P^2 - 4 Q \neq 0</math>. Ciągi Lucasa <math>U_n = U_n (P, Q)</math> i <math>V_n = V_n (P, Q)</math> definiujemy następująco
  
::<math>x k \equiv 1 \!\! \pmod{m}</math>
+
::<math>U_n = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} = {\small\frac{\alpha^n - \beta^n}{\sqrt{D}}}</math>
  
wtedy i&nbsp;tylko wtedy, gdy <math>\gcd (k, m) = 1</math>.
+
::<math>V_n = \alpha^n + \beta^n</math>
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
gdzie liczby
  
<math>\Large{\Longrightarrow}</math>
+
::<math>\alpha = {\small\frac{P + \sqrt{D}}{2}}</math>
  
Z założenia istnieje taka liczba <math>x</math>, że
+
::<math>\beta = {\small\frac{P - \sqrt{D}}{2}}</math>
  
::<math>x k \equiv 1 \!\! \pmod{m}</math>
+
są pierwiastkami równania <math>x^2 - P x + Q = 0</math>.
  
Zatem dla pewnego <math>r \in \mathbb{Z}</math> jest
 
  
::<math>x k = 1 + r m</math>
 
  
Czyli <math>x k - r m = 1</math>. Wynika stąd, że <math>\gcd (k, m)</math> dzieli <math>1</math>, co oznacza, że <math>\gcd (k, m) = 1</math>.
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M2</span><br/>
 +
Zauważmy, że:
  
<math>\Large{\Longleftarrow}</math>
+
::<math>P = \alpha + \beta</math>
  
Z założenia <math>\gcd (k, m) = 1</math>. Z&nbsp;lematu Bézouta (zobacz C73) wynika, że istnieją takie liczby całkowite <math>x, y</math>, że
+
::<math>Q = \alpha \beta</math>
  
::<math>k x + m y = 1</math>
+
::<math>\sqrt{D} = \alpha - \beta</math>
  
Zatem modulo <math>m</math> dostajemy
+
::<math>U_0 = 0</math>, <math>U_1 = 1</math>, <math>V_0 = 2</math> i <math>V_1 = P</math>
  
::<math>k x \equiv 1 \!\! \pmod{m}</math>
 
  
Co kończy dowód.<br/>
+
Warunek <math>P^2 - 4 Q \neq 0</math> wyklucza następujące pary <math>(P, Q)</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
::<math>(0, 0), (\pm 2, 1), (\pm 4, 4), (\pm 6, 9), (\pm 8, 16), (\pm 10, 25), (\pm 12, 36), ..., (\pm 2 n, n^2), ...</math>
  
  
<span style="font-size: 110%; font-weight: bold;">Definicja K2</span><br/>
 
Niech <math>m \in \mathbb{Z}_+</math>. Liczbę <math>x</math> taką, że
 
  
::<math>x \cdot k \equiv 1 \!\! \pmod{m}</math>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M3</span><br/>
 +
Oczywiście liczby <math>\alpha</math> i <math>\beta</math> są również pierwiastkami równania
  
będziemy nazywali elementem odwrotnym liczby <math>k</math> modulo <math>m</math> i&nbsp;oznaczali jako <math>k^{- 1}</math>.
+
::<math>x^{n + 2} - P x^{n + 1} + Q x^n = 0</math>
  
 +
Wynika stąd, że ciągi <math>(\alpha^n)</math> i <math>(\beta^n)</math> spełniają równania rekurencyjne
  
 +
::<math>\alpha^{n + 2} = P \alpha^{n + 1} - Q \alpha^n</math>
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K3</span><br/>
+
::<math>\beta^{n + 2} = P \beta^{n + 1} - Q \beta^n</math>
Oznaczenie elementu odwrotnego ma naturalne uzasadnienie. Zauważmy, że jeżeli <math>b \mid a</math> oraz <math>b</math> ma element odwrotny modulo <math>m</math>, to prawdziwa jest kongruencja
 
  
::<math>{\small\frac{a}{b}} \equiv a b^{- 1} \!\! \pmod{m}</math>
+
Ciągi Lucasa <math>(U_n)</math> i <math>(V_n)</math> spełniają identyczne równania rekurencyjne jak ciągi <math>(\alpha^n)</math> i <math>(\beta^n)</math>. Istotnie, odejmując i&nbsp;dodając stronami wypisane powyżej równania, otrzymujemy
  
Istotnie
+
::<math>U_{n + 2} = P U_{n + 1} - Q U_n</math>
  
::<math>{\small\frac{a}{b}} = {\small\frac{a}{b}} \cdot 1 \equiv {\small\frac{a}{b}} \cdot b b^{- 1} \equiv a b^{- 1}\!\! \pmod{m}</math>
+
::<math>V_{n + 2} = P V_{n + 1} - Q V_n</math>
  
W PARI/GP odwrotność liczby <math>a</math> modulo <math>m</math> znajdujemy, wpisując <code>Mod(a, m)^(-1)</code>.
+
Dlatego możemy zdefiniować ciągi Lucasa <math>(U_n)</math> i <math>(V_n)</math> w&nbsp;sposób równoważny
  
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K4</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Definicja M4</span><br/>
Niech <math>p</math> będzie liczbą pierwszą nieparzystą, a&nbsp;liczby <math>a, b</math> będą względnie pierwsze z <math>p</math>. Jeżeli liczby <math>a, b</math> są różne modulo <math>p</math>, to ich elementy odwrotne <math>a^{-1}, b^{- 1}</math> też różne modulo <math>p</math>.
+
Niech <math>P, Q \in \mathbb{Z} \setminus \{0\}</math> oraz <math>D = P^2 - 4 Q \neq 0</math>. Ciągi Lucasa <math>(U_n)</math> i <math>(V_n)</math> określone następującymi wzorami rekurencyjnymi
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
::<math>U_0 = 0</math>, <math>U_1 = 1</math>, <math>U_n = P U_{n - 1} - Q U_{n - 2}</math>
Z założenia <math>a \not\equiv b \!\! \pmod{p}</math>. Gdyby było
 
  
::<math>a^{- 1} \equiv b^{- 1} \!\! \pmod{p}</math>
+
::<math>V_0 = 2</math>, <math>V_1 = P</math>, <math>V_n = P V_{n - 1} - Q V_{n - 2}</math>
  
to mielibyśmy
 
  
::<math>a^{- 1} a b \equiv b^{- 1} a b \!\! \pmod{p}</math>
 
 
Czyli
 
 
::<math>b \equiv a \!\! \pmod{p}</math>
 
 
Wbrew uczynionemu założeniu. Co kończy dowód.<br/>
 
&#9633;
 
{{\Spoiler}}
 
  
 +
<span style="font-size: 110%; font-weight: bold;">Przykład M5</span><br/>
 +
Początkowe wyrazy ciągów Lucasa
  
 +
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: left; margin-right: auto;"
 +
|-
 +
! <math>\boldsymbol{n}</math> !! <math>\boldsymbol{U_n (P, Q)}</math> !! <math>\boldsymbol{V_n (P, Q)}</math>
 +
|-
 +
| &nbsp;&nbsp;<math>0</math>&nbsp;&nbsp; || <math>0</math> || <math>2</math>
 +
|-
 +
| &nbsp;&nbsp;<math>1</math>&nbsp;&nbsp; || <math>1</math> || <math>P</math>
 +
|-
 +
| &nbsp;&nbsp;<math>2</math>&nbsp;&nbsp; || <math>P</math> || <math>P^2 - 2 Q</math>
 +
|-
 +
| &nbsp;&nbsp;<math>3</math>&nbsp;&nbsp; || <math>P^2 - Q</math> || <math>P^3 - 3 P Q</math>
 +
|-
 +
| &nbsp;&nbsp;<math>4</math>&nbsp;&nbsp; || <math>P^3 - 2 P Q</math> || <math>P^4 - 4 P^2 Q + 2 Q^2</math>
 +
|-
 +
| &nbsp;&nbsp;<math>5</math>&nbsp;&nbsp; || <math>P^4 - 3 P^2 Q + Q^2</math> || <math>P^5 - 5 P^3 Q + 5 P Q^2</math>
 +
|-
 +
| &nbsp;&nbsp;<math>6</math>&nbsp;&nbsp; || <math>P^5 - 4 P^3 Q + 3 P Q^2</math> || <math>P^6 - 6 P^4 Q + 9 P^2 Q^2 - 2 Q^3</math>
 +
|-
 +
| &nbsp;&nbsp;<math>7</math>&nbsp;&nbsp; || <math>P^6 - 5 P^4 Q + 6 P^2 Q^2 - Q^3</math> || <math>P^7 - 7 P^5 Q + 14 P^3 Q^2 - 7 P Q^3</math>
 +
|-
 +
| &nbsp;&nbsp;<math>8</math>&nbsp;&nbsp; || <math>P^7 - 6 P^5 Q + 10 P^3 Q^2 - 4 P Q^3</math> || <math>P^8 - 8 P^6 Q + 20 P^4 Q^2 - 16 P^2 Q^3 + 2 Q^4</math>
 +
|-
 +
| &nbsp;&nbsp;<math>9</math>&nbsp;&nbsp; || <math>P^8 - 7 P^6 Q + 15 P^4 Q^2 - 10 P^2 Q^3 + Q^4</math> || <math>P^9 - 9 P^7 Q + 27 P^5 Q^2 - 30 P^3 Q^3 + 9 P Q^4</math>
 +
|}
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K5</span><br/>
 
Niech <math>p</math> będzie liczbą pierwszą nieparzystą, zbiór <math>R = \{ 1, 2, \ldots, p - 1 \}</math>, a&nbsp;zbiór <math>S</math> będzie identyczny ze zbiorem <math>R</math> modulo <math>p</math>. Jeżeli liczby <math>x_k \in S</math> przebiegają cały zbiór <math>S</math>, to liczby <math>x^{- 1}_k</math> przebiegają zbiór <math>T</math> identyczny ze zbiorem <math>R</math> modulo <math>p</math>.
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M6</span><br/>
Z założenia zbiory <math>R</math> i <math>S</math> są identyczne modulo <math>R</math>. Zatem każdej liczbie <math>k \in R</math> odpowiada dokładnie jedna liczba <math>x_k \in S</math> taka, że
+
W PARI/GP możemy napisać prosty kod, który pozwoli obliczyć wartości wyrazów <math>U_n (P, Q)</math> i <math>V_n (P, Q)</math>
  
::<math>x_k \equiv k \!\! \pmod{p}</math>
+
<span style="font-size: 90%; color:black;">LucasU(n, P, Q) = '''if'''( n == 0, 0, '''if'''( n == 1, 1, P*LucasU(n-1, P, Q) - Q*LucasU(n-2, P, Q) ) )</span>
  
Ponieważ <math>\gcd (k, p) = 1</math>, to również <math>\gcd (x_k, p) = 1</math>. Zatem liczba <math>x_k</math> ma element odwrotny <math>x^{- 1}_k</math> modulo <math>p</math>. Ponieważ wszystkie liczby <math>x_k</math> są różne modulo <math>p</math>, to elementy odwrotne <math>x^{- 1}_k</math> też są wszystkie różne modulo <math>p</math>. Ponieważ liczb <math>x^{- 1}_k</math> jest dokładnie <math>p - 1</math>, to tworzą one pewien zbiór <math>T</math> identyczny ze zbiorem <math>R</math> modulo <math>p</math>. Co kończy dowód.<br/>
+
<span style="font-size: 90%; color:black;">LucasV(n, P, Q) = '''if'''( n == 0, 2, '''if'''( n == 1, P, P*LucasV(n-1, P, Q) - Q*LucasV(n-2, P, Q) ) )</span>
&#9633;
 
{{\Spoiler}}
 
  
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K6</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M7</span><br/>
Niech <math>p</math> będzie liczbą pierwszą nieparzystą.
+
Niech <math>D = P^2 - 4 Q</math>. Wyrazy ciągów Lucasa można przedstawić w&nbsp;postaci sumy
  
Jeżeli <math>a</math> jest liczbą kwadratową (odpowiednio niekwadratową) modulo <math>p</math>, to element odwrotny liczby <math>a</math> modulo <math>p</math> istnieje i&nbsp;jest liczbą kwadratową (odpowiednio niekwadratową) modulo <math>p</math>.
+
::<math>2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k</math>
  
Jeżeli <math>a, b</math> są liczbami kwadratowymi (odpowiednio niekwadratowymi) modulo <math>p</math>, to istnieje taka liczba <math>r</math>, że <math>a \equiv b r^2 \!\! \pmod{p}</math>
+
::<math>2^{n - 1} V_n = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k</math>
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Z założenia <math>a</math> jest liczbą kwadratową (niekwadratową) modulo <math>p</math>, zatem <math>\gcd (a, p) = 1</math>, czyli element odwrotny liczby <math>a</math> modulo <math>p</math> istnieje. Mamy
+
Oznaczmy <math>\delta = \sqrt{D}</math>, zatem <math>2 \alpha = P + \delta</math> i <math>2 \beta = P - \delta</math>. Ze wzoru dwumianowego, mamy
  
::<math>1 = \left( {\small\frac{1}{p}} \right)_{\small{\!\! L}}
+
::<math>2^n \alpha^n = (P + \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} \delta^j</math>
= \left( {\small\frac{a a^{- 1}}{p}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{a}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{a^{- 1}}{p}} \right)_{\small{\!\! L}}</math>
 
  
Zatem musi być
+
::<math>2^n \beta^n = (P - \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (- \delta)^j</math>
  
::<math>\left( {\small\frac{a^{- 1}}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{a}{p}} \right)_{\small{\!\! L}}</math>
+
Obliczając sumę powyższych wzorów, otrzymujemy
  
Co należało pokazać.
+
::<math>2^n (\alpha^n + \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j + (- \delta)^j)</math>
  
 +
:::::<math>\quad \: = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} \cdot 2 \delta^{2 k}</math>
  
Niech <math>a, b</math> będą liczbami kwadratowymi (niekwadratowymi). Iloczyn <math>a b^{- 1}</math> jest liczbą kwadratową, bo
+
:::::<math>\quad \: = 2 \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k</math>
  
::<math>\left( {\small\frac{a b^{- 1}}{p}} \right)_{\small{\!\! L}}
+
gdzie <math>j = 2 k</math> i&nbsp;sumowanie przebiega od <math>k = 0</math> do <math>k = \lfloor n / 2 \rfloor</math>
= \left( {\small\frac{a}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{b^{- 1}}{p}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{a}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{b}{p}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{\pm 1}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{\pm 1}{p}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{\pm 1}{p}} \right)_{\small{\!\! L}}^{\! 2}
 
= 1</math>
 
  
Zatem istnieje taka liczba <math>r</math>, że
+
Zatem
  
::<math>a b^{- 1} \equiv r^2 \!\! \pmod{p}</math>
+
::<math>2^{n - 1} V_n = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k</math>
  
Czyli
 
  
::<math>a \equiv b r^2 \!\! \pmod{p}</math>
+
Obliczając różnicę tych wzorów, mamy
  
Co należało pokazać.<br/>
+
::<math>2^n (\alpha^n - \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j - (- \delta)^j)</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
:::::<math>\quad \: = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} \cdot 2 \delta^{2 k + 1}</math>
  
 +
:::::<math>\quad \: = 2 \delta \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k</math>
  
 +
gdzie <math>j = 2 k + 1</math> i&nbsp;sumowanie przebiega od <math>k = 0</math> do <math>k = \lfloor (n - 1) / 2 \rfloor</math>
  
  
== Przykłady sum symboli Legendre'a ==
+
Zatem
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K7</span><br/>
 
Niech <math>p</math> będzie liczbą pierwszą nieparzystą, <math>a, d \in \mathbb{Z}</math> i <math>p \nmid d</math>. Pokazać, że
 
 
 
::<math>\sum_{k = 1}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = \sum_{k = 0}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = 0</math>
 
 
 
::<math>\sum_{k = 1}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} = \sum_{k = 0}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} = p - 1</math>
 
 
 
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{a + k d}{p}} \right)_{\small{\!\! L}} = 0</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
 
 
'''Punkt 1.'''
 
 
 
Wystarczy zauważyć, że wśród liczb <math>1, 2, \ldots, p - 1</math> jest <math>{\small\frac{p - 1}{2}}</math> liczb kwadratowych modulo <math>p</math> i <math>{\small\frac{p - 1}{2}}</math> liczb niekwadratowych modulo <math>p</math>. Zatem
 
 
 
::<math>\sum_{k = 1}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = {\small\frac{p - 1}{2}} \cdot 1 + {\small\frac{p - 1}{2}} \cdot (- 1) = 0</math>
 
 
 
'''Punkt 2.'''
 
 
 
Wystarczy zauważyć, że
 
 
 
::<math>\left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}^{\! 2}</math>
 
 
 
oraz że wśród liczb <math>1, 2, \ldots, p - 1</math> jest <math>{\small\frac{p - 1}{2}}</math> liczb kwadratowych modulo <math>p</math> i <math>{\small\frac{p - 1}{2}}</math> liczb niekwadratowych modulo <math>p</math>. Zatem
 
 
 
::<math>\sum_{k = 1}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = {\small\frac{p - 1}{2}} \cdot 1^2 + {\small\frac{p - 1}{2}} \cdot (- 1)^2 = p - 1</math>
 
 
 
'''Punkt 3.'''
 
 
 
Z założenia liczby <math>p</math> i <math>d</math> są względnie pierwsze. Z&nbsp;twierdzenia C57 wiemy, że reszty <math>r_1, r_2, \ldots, r_p</math> z&nbsp;dzielenia <math>p</math> kolejnych liczb postaci
 
 
 
::<math>x_k = a + k d</math>
 
 
 
przez liczbę <math>p</math> są wszystkie różne i&nbsp;tworzą zbiór <math>S = \{ 0, 1, \ldots, p - 1 \}</math>. Czyli wśród reszt <math>r_1, r_2, \ldots, r_p</math> jest <math>{\small\frac{p - 1}{2}}</math> liczb kwadratowych modulo <math>p</math>, tyle samo liczb niekwadratowych modulo <math>p</math>, a&nbsp;jedna z&nbsp;tych reszt jest podzielna przez <math>p</math>. Z&nbsp;własności symbolu Legendre'a wiemy, że licznik wpływa na wartość symbolu jedynie modulo mianownik (zobacz J31 p. 2). Zatem możemy napisać
 
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{a + k d}{p}} \right)_{\small{\!\! L}}  
+
::<math>2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\sqrt{D}}} = 2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k</math>
= \sum_{j = 0}^{p - 1} \left( {\small\frac{r_j}{p}} \right)_{\small{\!\! L}}  
 
= {\small\frac{p - 1}{2}} \cdot 1 + {\small\frac{p - 1}{2}} \cdot (- 1) + 0
 
= 0</math>
 
  
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
Linia 197: Linia 161:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K8* (George Pólya, Iwan Winogradow, 1918)</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M8</span><br/>
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>m, n \in \mathbb{N}_0</math>, to prawdziwe jest oszacowanie
+
Korzystając z&nbsp;twierdzenia M7, możemy napisać proste funkcje do znajdowania postaci kolejnych wyrazów <math>U_n (P, Q)</math> i <math>V_n (P, Q)</math>
  
::<math>\left| \sum_{t = m}^{m + n} \left( {\small\frac{t}{p}} \right)_{\small{\!\! L}} \right| < \sqrt{p} \log p</math>
+
<span style="font-size: 90%; color:black;">U(n) = 2^(1 - n)*'''sum'''(k=0, '''floor'''((n-1)/2), '''binomial'''(n, 2*k+1) * P^(n-2*k-1) * (P^2-4*Q)^k)</span>
  
 +
<span style="font-size: 90%; color:black;">V(n) = 2^(1 - n)*'''sum'''(k=0, '''floor'''(n/2), '''binomial'''(n, 2*k) * P^(n-2*k) * (P^2-4*Q)^k)</span>
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K9</span><br/>
 
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>a, b \in \mathbb{Z}</math>, to
 
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + b}{p}} \right)_{\small{\!\! L}}
+
Często możemy spotkać założenie <math>P \geqslant 1</math>. Poniższe twierdzenie wyjaśnia, dlaczego tak jest.
= \begin{cases}
 
\;\;\:\,      - 1 & \text{gdy } \, p \nmid (a - b) \\
 
    p - 1 & \text{gdy } \, p \mid (a - b) \\
 
\end{cases}</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M9</span><br/>
 +
Jeżeli <math>(U_n)</math> i <math>(V_n)</math> są ciągami Lucasa, to
  
'''1. Przypadek, gdy <math>\boldsymbol{p \mid (a - b)}</math>'''
+
::<math>U_n (- P, Q) = (- 1)^{n - 1} U_n (P, Q)</math>
  
Z założenia <math>b \equiv a \!\! \pmod{p}</math>
+
::<math>V_n (- P, Q) = (- 1)^n V_n (P, Q)</math>
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + b}{p}} \right)_{\small{\!\! L}}
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
= \sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}}  
+
Niech
= \sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}}^{\! 2}</math>
 
  
Z&nbsp;twierdzenia C57 wiemy, że reszty <math>r_1, r_2, \ldots, r_p</math> z&nbsp;dzielenia <math>p</math> kolejnych liczb postaci
+
::<math>\alpha = \frac{P + \sqrt{D}}{2} \qquad \qquad \;\; \beta = \frac{P - \sqrt{D}}{2}</math>
  
::<math>x_k = a + k</math>
+
::<math>a = \frac{- P + \sqrt{D}}{2} \qquad \qquad b = \frac{- P - \sqrt{D}}{2}</math>
  
przez liczbę <math>p</math> są wszystkie różne i&nbsp;tworzą zbiór <math>S = \{ 0, 1, \ldots, p - 1 \}</math>. Czyli wśród reszt <math>r_1, r_2, \ldots, r_p</math> jest <math>{\small\frac{p - 1}{2}}</math> liczb kwadratowych modulo <math>p</math>, tyle samo liczb niekwadratowych modulo <math>p</math>, a&nbsp;jedna z&nbsp;tych reszt jest podzielna przez <math>p</math>. Z&nbsp;własności symbolu Legendre'a wiemy, że licznik wpływa na wartość symbolu jedynie modulo mianownik (zobacz J31 p. 2). Zatem możemy napisać
+
Liczby <math>\alpha, \beta</math> oraz <math>a, b</math> są odpowiednio pierwiastkami równań
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}}^{\! 2}
+
::<math>x^2 - P x + Q = 0</math>
= \sum_{k = 0}^{p - 1} \left( {\small\frac{r_k}{p}} \right)_{\small{\!\! L}}^{\! 2}
 
= p - 1</math>
 
  
Co należało pokazać.
+
::<math>x^2 + P x + Q = 0</math>
  
'''2. Przypadek, gdy <math>\boldsymbol{p \nmid (a - b)}</math>'''
+
Zatem definiują one ciągi Lucasa
  
Kładąc <math>j = k + a</math> i&nbsp;sumując od <math>a</math> do <math>p - 1 + a</math>, otrzymujemy
+
::<math>U_n (P, Q) = \frac{\alpha^n - \beta^n}{\alpha - \beta} \qquad \qquad \;\; V_n (P, Q) = \alpha^n + \beta^n</math>
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + b}{p}} \right)_{\small{\!\! L}}
+
::<math>U_n (- P, Q) = \frac{a^n - b^n}{a - b} \qquad \qquad V_n (- P, Q) = a^n + b^n</math>
= \sum_{j = a}^{p - 1 + a} \left( {\small\frac{j}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{j + b - a}{p}} \right)_{\small{\!\! L}}</math>
 
  
Wśród <math>p</math> kolejnych liczb <math>a, a + 1, \ldots, p - 1 + a</math> istnieje dokładnie jedna liczba podzielna przez <math>p</math>. Możemy ją pominąć, bo nie wnosi ona wkładu do wyliczanej sumy.
+
Zauważmy, że
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + b}{p}} \right)_{\small{\!\! L}}
+
::<math>\alpha - \beta = a - b = \sqrt{D}</math>
= \underset{p \nmid j}{\sum_{j = a}^{p - 1 + a}} \left( {\small\frac{j}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{j + b - a}{p}} \right)_{\small{\!\! L}}</math>
 
  
::::::::<math>\;\;\, = \underset{p \nmid j}{\sum_{j = a}^{p - 1 + a}} \left( {\small\frac{j}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{j + (b - a) j j^{- 1}}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>\frac{a}{\beta} = \frac{b}{\alpha} = - 1</math>
  
::::::::<math>\;\;\, = \underset{p \nmid j}{\sum_{j = a}^{p - 1 + a}} \left( {\small\frac{j^2}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{1 + (b - a) j^{- 1}}{p}} \right)_{\small{\!\! L}}</math>
+
Łatwo znajdujemy
  
::::::::<math>\;\;\, = \underset{p \nmid j}{\sum_{j = a}^{p - 1 + a}} \left( {\small\frac{1 + (b - a) j^{- 1}}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_n (- P, Q) = \frac{a^n - b^n}{a - b} = \frac{(- \beta)^n - (- \alpha)^n}{\sqrt{D}} = (- 1)^n \cdot \frac{\beta^n - \alpha^n}{\alpha - \beta} = (- 1)^{n - 1} \cdot U_n (P, Q)</math>
  
Z własności symbolu Legendre'a wiemy, że licznik wpływa na wartość symbolu jedynie modulo mianownik. Wiemy też, że gdy liczby <math>j</math> przebiegają zbiór identyczny (modulo <math>p</math>) ze zbiorem <math>R = \{ 1, 2, \ldots, p - 1 \}</math>, to liczby <math>j^{- 1}</math> przebiegają pewien zbiór <math>S</math> identyczny (modulo <math>p</math>) ze zbiorem <math>R</math> (zobacz K5). Zatem od sumowania po <math>j</math> możemy przejść do sumowania po <math>r \in R</math>.
+
::<math>V_n (- P, Q) = a^n + b^n = (- \beta)^n + (- \alpha)^n = (- 1)^n \cdot (\alpha^n + \beta^n) = (- 1)^n \cdot V_n (P, Q)</math>
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k + a}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + b}{p}} \right)_{\small{\!\! L}}
+
Co należało pokazać.<br/>
= \sum_{r = 1}^{p - 1} \left( {\small\frac{1 + (b - a) r}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
::::::::<math>\;\;\, = - \left( {\small\frac{1}{p}} \right)_{\small{\!\! L}} + \sum_{r = 0}^{p - 1} \left( {\small\frac{1 + (b - a) r}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
::::::::<math>\;\;\, = - 1</math>
 
 
 
Ostatnia z&nbsp;wypisanych sum jest równa zero, co wynika z&nbsp;trzeciego wzoru twierdzenia K7 i&nbsp;faktu, że <math>p \nmid (b - a)</math>. Co należało pokazać.<br/>
 
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 268: Linia 216:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K10</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Zadanie M10</span><br/>
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>n \in \mathbb{Z}</math>, to
+
Pokazać, że jeżeli <math>P, Q \in \mathbb{Z} \setminus \{ 0 \}</math> i <math>D = P^2 - 4 Q \neq 0</math>, to
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + n}{p}} \right)_{\small{\!\! L}} =
+
::<math>U_n (2 P, 4 Q) = 2^{n - 1} U_n (P, Q)</math>
\begin{cases}
 
\;\;\:\,      - 1 & \text{gdy } \, p \nmid n \\
 
    p - 1 & \text{gdy } \, p \mid n \\
 
\end{cases}</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
::<math>V_n (2 P, 4 Q) = 2^n V_n (P, Q)</math>
  
'''Przypadek, gdy <math>\boldsymbol{p \mid n}</math>
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 +
Niech
  
Z drugiego wzoru twierdzenia K7 otrzymujemy
+
::<math>\alpha = {\small\frac{P + \sqrt{D}}{2}} \qquad \qquad \;\; \beta = {\small\frac{P - \sqrt{D}}{2}}</math>
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + n}{p}} \right)_{\small{\!\! L}} = \sum_{k = 0}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} = p - 1</math>
+
::<math>a = P + \sqrt{D} \qquad \qquad \;\; b = P - \sqrt{D}</math>
  
'''Przypadek, gdy <math>\boldsymbol{p \nmid n}</math>
+
Liczby <math>\alpha, \beta</math> oraz <math>a, b</math> są odpowiednio pierwiastkami równań
  
Jeżeli liczby <math>a, b</math> są obie liczbami kwadratowymi lub obie liczbami niekwadratowymi modulo <math>p</math>, to istnieje taka liczba <math>r</math>, że
+
::<math>x^2 - P x + Q = 0</math>
  
::<math>a \equiv b r^2 \!\! \pmod{p}</math>
+
::<math>x^2 - 2 P x + 4 Q = 0</math>
  
(zobacz K6). Zatem  
+
Zatem definiują one ciągi Lucasa
  
::<math>S(a) = \sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + a}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_n (P, Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad \;\;\; V_n (P, Q) = \alpha^n + \beta^n</math>
  
:::<math>\;\;\; = \sum^{p - 1}_{k = 0} \left( {\small\frac{k^2 + b r^2}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_n (2 P, 4 Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (2 P, 4 Q) = a^n + b^n</math>
  
:::<math>\;\;\; = \sum_{k = 0}^{p - 1} \left( {\small\frac{r^2 \left[ (k r^{- 1})^2 + b \right] }{p}} \right)_{\small{\!\! L}}</math>
+
Zauważmy, że
  
:::<math>\;\;\; = \left( {\small\frac{r^2}{p}} \right)_{\small{\!\! L}} \sum_{k = 0}^{p - 1} \left( {\small\frac{(k r^{- 1})^2 + b}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>\alpha - \beta = \sqrt{D}</math>
  
:::<math>\;\;\; = \sum_{k = 0}^{p - 1} \left( {\small\frac{(k r^{- 1})^2 + b}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>a - b = 2 \sqrt{D}</math>
  
Z twierdzenia C57 wiemy, że gdy <math>k</math> przebiega zbiór <math>T = \{ 0, 1, \ldots, p - 1 \}</math>, to <math>k r^{- 1}</math> przebiega zbiór <math>T'</math> identyczny ze zbiorem <math>T</math> modulo <math>p</math>. Zatem
+
::<math>{\small\frac{a}{\alpha}} = {\small\frac{b}{\beta}} = 2</math>
  
::<math>S(a) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^2 + b}{p}} \right)_{\small{\!\! L}} = S (b)</math>
+
Łatwo znajdujemy
  
 +
::<math>U_n (2 P, 4 Q) = {\small\frac{a^n - b^n}{a - b}} = {\small\frac{(2 \alpha)^n - (2 \beta)^n}{2 \sqrt{D}}} = 2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} = 2^{n - 1} U_n (P, Q)</math>
  
Wynika stąd, że dla wszystkich liczb kwadratowych (odpowiednio niekwadratowych) modulo <math>p</math> wyrażenie <math>S(n)</math> ma taką samą wartość i&nbsp;jeśli wybierzemy liczby <math>a, b</math> tak, aby jedna była liczbą kwadratową, a&nbsp;druga liczbą niekwadratową modulo <math>p</math>, to możemy napisać
+
::<math>V_n (2 P, 4 Q) = a^n + b^n = (2 \alpha)^n + (2 \beta)^n = 2^n (\alpha^n + \beta^n) = 2^n V_n (P, Q)</math>
  
::<math>\sum_{n = 1}^{p - 1} S (n) = {\small\frac{p - 1}{2}} (S (a) + S (b))</math>
+
Co należało pokazać.<br/>
 
 
 
 
Z drugiej strony
 
 
 
::<math>\sum_{n = 1}^{p - 1} S (n) = \sum_{n = 1}^{p - 1} \sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + n}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
::::<math>\;\;\;\: = \sum_{k = 0}^{p - 1} \sum_{n = 1}^{p - 1} \left( {\small\frac{k^2 + n}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
::::<math>\;\;\;\: = \sum_{k = 0}^{p - 1} \left[ - \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} + \sum_{n = 0}^{p - 1} \left( {\small\frac{k^2 + n}{p}} \right)_{\small{\!\! L}} \right]</math>
 
 
 
::::<math>\;\;\;\: = - \sum_{k = 0}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}^{\! 2}</math>
 
 
 
::::<math>\;\;\;\: = - (p - 1)</math>
 
 
 
bo z&nbsp;twierdzenia K7 wiemy, że
 
 
 
::<math>\sum_{n = 0}^{p - 1} \left( {\small\frac{n + k^2}{p}} \right)_{\small{\!\! L}} = 0</math>
 
 
 
 
 
Łącząc uzyskane rezultaty, dostajemy
 
 
 
::<math>- (p - 1) = {\small\frac{p - 1}{2}} (S (a) + S (b))</math>
 
 
 
Zatem
 
 
 
::<math>S(a) + S (b) = - 2</math>
 
 
 
 
 
Z twierdzenia K9 mamy
 
 
 
::<math>S(- 1) = \sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 - 1}{p}} \right)_{\small{\!\! L}}
 
= \sum^{p - 1}_{k = 0} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
= - 1</math>
 
 
 
bo <math>p \nmid 2</math>. Dla ustalenia uwagi przyjmijmy, że <math>a</math> jest liczbą kwadratową, a <math>b</math> jest liczbą niekwadratową modulo <math>p</math>. Jeżeli <math>- 1</math> jest liczbą kwadratową modulo <math>p</math>, to <math>S(a) = - 1</math> i&nbsp;natychmiast otrzymujemy, że <math>S(b) = - 1</math>. Jeżeli <math>- 1</math> jest liczbą niekwadratową modulo <math>p</math>, to <math>S(b) = - 1</math> i&nbsp;natychmiast otrzymujemy, że <math>S(a) = - 1</math>. Zatem bez względu na to, czy <math>n</math> jest liczbą kwadratową, czy liczbą niekwadratową modulo <math>p</math>, musi być <math>S(n) = - 1</math>. Co należało pokazać.<br/>
 
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 351: Linia 262:
  
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K11</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Zadanie M11</span><br/>
Pokazać, że jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>r , s \in \mathbb{Z}</math>, to
+
Pokazać, że jeżeli <math>Q \in \mathbb{Z} \setminus \{ 0 \}</math> oraz <math>P = 4 Q - 1</math>, to
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + r k + s}{p}} \right)_{\small{\!\! L}} =
+
::<math>U_{2 k} (P, P Q) = - (- P)^k U_{2 k} (1, Q)</math>
\begin{cases}
 
\;\;\:\,      - 1 & \text{gdy } \, p \nmid (r^2 - 4 s) \\
 
    p - 1 & \text{gdy } \, p \mid (r^2 - 4 s) \\
 
\end{cases}</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
::<math>U_{2 k + 1} (P, P Q) = (- P)^k V_{2 k + 1} (1, Q)</math>
  
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + r k + s}{p}} \right)_{\small{\!\! L}} = \sum_{k = 0}^{p - 1} \left( {\small\frac{2^2}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k^2 + r k + s}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>V_{2 k} (P, P Q) = (- P)^k V_{2 k} (1, Q)</math>
  
:::::::<math>\;\;\;\, = \sum_{k = 0}^{p - 1} \left( {\small\frac{4 k^2 + 4 r k + 4 s}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>V_{2 k + 1} (P, P Q) = - (- P)^{k + 1} U_{2 k + 1} (1, Q)</math>
 
 
:::::::<math>\;\;\;\, = \sum^{p - 1}_{k = 0} \left( {\small\frac{(2 k + r)^2 + 4 s - r^2}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Z twierdzenia C57 wiemy, że gdy <math>k</math> przebiega zbiór <math>T = \{ 0, 1, \ldots, p - 1 \}</math>, to <math>2 k + r</math> przebiega zbiór <math>T'</math> identyczny ze zbiorem <math>T</math> modulo <math>p</math>. Zatem
 
 
 
::<math>\sum_{k = 0}^{p - 1} \left( {\small\frac{k^2 + r k + s}{p}} \right)_{\small{\!\! L}} = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^2 + 4 s - r^2}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Z twierdzenia K10 wynika natychmiast teza dowodzonego twierdzenia.<br/>
 
&#9633;
 
{{\Spoiler}}
 
  
 +
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 +
Niech
  
 +
::<math>\alpha = {\small\frac{1 + \sqrt{- P}}{2}} \qquad \qquad \beta = {\small\frac{1 - \sqrt{- P}}{2}}</math>
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K12</span><br/>
+
::<math>a = {\small\frac{P + \sqrt{- P}}{2}} \qquad \qquad b = {\small\frac{P - \sqrt{- P}}{2}}</math>
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>n \in \mathbb{Z}</math>, to dla sumy
 
  
::<math>S(n) = \sum_{k = 0}^{p - 1} \left( {\small\frac{k (k^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
+
Liczby <math>\alpha, \beta</math> oraz <math>a, b</math> są odpowiednio pierwiastkami równań
  
prawdziwe są następujące wzory
+
::<math>x^2 - x + {\small\frac{P + 1}{4}} = 0</math>
  
::(a) <math>\;\; S(n) = 0 \qquad \qquad \text{gdy } \; p = 4 k + 3</math>
+
::<math>x^2 - P x + {\small\frac{P (P + 1)}{4}} = 0</math>
  
::(b) <math>\;\; | S (n) | < 2 \sqrt{p} \qquad \text{gdy } \; p = 4 k + 1</math>
+
Z założenia <math>P = 4 Q - 1</math>, zatem
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
::<math>x^2 - x + Q = 0</math>
  
'''Punkt (a)'''
+
::<math>x^2 - P x + P Q = 0</math>
  
Zauważmy, że zbiory <math>R = \{ 0, 1, 2, \ldots, p - 1 \}</math> oraz <math>T = \{ - p + 1, - p + 2, \ldots, - p + (p - 1), 0 \}</math> są identyczne modulo <math>p</math>. Z&nbsp;własności symbolu Legendre'a wiemy, że licznik wpływa na wartość symbolu jedynie modulo mianownik (zobacz J31 p.2). Zatem możemy sumowanie po <math>k \in R</math> zastąpić sumowaniem po <math>j \in T .</math> Otrzymujemy
+
Czyli definiują one ciągi Lucasa
  
::<math>S(n) = \sum_{j = - p + 1}^{0} \left( {\small\frac{j (j^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_n (1, Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad \:\:\: V_n (1, Q) = \alpha^n + \beta^n</math>
  
Kładąc <math>j = - r</math> i&nbsp;sumując po <math>r</math> od <math>0</math> do <math>p - 1</math>, dostajemy
+
::<math>U_n (P, P Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (P, P Q) = a^n + b^n</math>
  
::<math>S(n) = \sum_{r = 0}^{p - 1} \left( {\small\frac{- r}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{(- r)^2 + n}{p}} \right)_{\small{\!\! L}}
+
Zauważmy, że
= \sum_{r = 0}^{p - 1} \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{r}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{r^2 + n}{p}} \right)_{\small{\!\! L}} 
 
= \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} S (n)</math>
 
  
Jeżeli <math>p = 4 k + 3</math>, to <math>S (n) = - S (n)</math>, czyli <math>S(n) = 0</math>.
+
::<math>\alpha - \beta = a - b = \sqrt{- P}</math>
  
'''Punkt (b)'''
+
::<math>{\small\frac{a}{\beta}} = {\small\frac{P + \sqrt{- P}}{1 - \sqrt{- P}}} = \sqrt{- P}</math>
  
Pomysł dowodu zaczerpnęliśmy z materiałów szkoleniowych Międzynarodowej Olimpiady Matematycznej<ref name="Dukic1"/>.
+
::<math>{\small\frac{b}{\alpha}} = {\small\frac{P - \sqrt{- P}}{1 + \sqrt{- P}}} = - \sqrt{- P}</math>
  
Jeżeli liczby <math>a, b</math> są obie liczbami kwadratowymi lub obie liczbami niekwadratowymi modulo <math>p</math>, to istnieje taka liczba <math>r</math>, że
 
  
::<math>a \equiv b r^2 \!\! \pmod{p}</math>
+
Łatwo znajdujemy
  
(zobacz K6). Zatem
+
::<math>U_{2 k} (P, P Q) = \frac{a^{2 k} - b^{2 k}}{a - b} = \frac{\left( \beta \sqrt{- P} \right)^{2 k} - \left( - \alpha \sqrt{- P} \right)^{2 k}}{\sqrt{- P}} = \frac{(- P)^k (\beta^{2 k} - \alpha^{2 k})}{\alpha - \beta} = - (- P)^k U_{2 k} (1, Q)</math>
  
::<math>S(a) = S (b r^2) = \sum_{k = 0}^{p - 1} \left( {\small\frac{k (k^2 + b r^2)}{p}} \right)_{\small{\!\! L}}</math>
 
  
::::::<math>\;\:\, = \sum_{k = 0}^{p - 1} \left( {\small\frac{r^3 (k r^{- 1}) \left[ (k r^{- 1})^2 + b \right] }{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_{2 k + 1} (P, P Q) = \frac{a^{2 k + 1} - b^{2 k + 1}}{a - b} = \frac{\left( \beta \sqrt{- P} \right)^{2 k + 1} - \left( - \alpha \sqrt{- P} \right)^{2 k + 1}}{\sqrt{- P}} = (- P)^k (\beta^{2 k + 1} + \alpha^{2 k + 1}) = (- P)^k V_{2 k + 1} (1, Q)</math>
  
::::::<math>\;\:\, = \left( {\small\frac{r^3}{p}} \right)_{\small{\!\! L}} \sum_{k = 0}^{p - 1} \left( {\small\frac{(k r^{- 1}) \left[ (k r^{- 1})^2 + b \right] }{p}} \right)_{\small{\!\! L}}</math>
 
  
::::::<math>\;\:\, = \left( {\small\frac{r}{p}} \right)_{\small{\!\! L}} \sum_{k = 0}^{p - 1} \left( {\small\frac{(k r^{- 1}) \left[ (k r^{- 1})^2 + b \right] }{p}} \right)_{\small{\!\! L}}</math>
+
::<math>V_{2 k} (P, P Q) = a^{2 k} + b^{2 k} = \left( \beta \sqrt{- P} \right)^{2 k} + \left( - \alpha \sqrt{- P} \right)^{2 k} = (- P)^k (\alpha^{2 k} + \beta^{2 k}) = (- P)^k V_{2 k} (1, Q)</math>
  
Z twierdzenia C57 wiemy, że gdy <math>k</math> przebiega zbiór <math>T = \{ 0, 1, \ldots, p - 1 \}</math>, to <math>k r^{- 1}</math> przebiega zbiór <math>T'</math> identyczny ze zbiorem <math>T</math> modulo <math>p</math>. Zatem
 
  
::<math>S(a) = \left( {\small\frac{r}{p}} \right)_{\small{\!\! L}} \sum_{x = 0}^{p - 1} \left( {\small\frac{x (x^2 + b)}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{r}{p}} \right)_{\small{\!\! L}} S (b)</math>
+
::<math>V_{2 k + 1} (P, P Q) = a^{2 k + 1} + b^{2 k + 1} = \left( \beta \sqrt{- P} \right)^{2 k + 1} + \left( - \alpha \sqrt{- P} \right)^{2 k + 1} = (- P)^{k + 1} \cdot \frac{\beta^{2 k + 1} - \alpha^{2 k + 1}}{\sqrt{- P}} = - (- P)^{k + 1} U_{2 k + 1} (1, Q)</math>
  
Czyli <math>S (a)^2 = S (b)^2</math>. Wynika stąd, że dla wszystkich liczb kwadratowych (odpowiednio niekwadratowych) modulo <math>p</math> wyrażenie <math>S (n)^2</math> ma taką samą wartość i&nbsp;jeśli wybierzemy liczby <math>a, b</math> tak, aby jedna była liczbą kwadratową, a&nbsp;druga liczbą niekwadratową modulo <math>p</math>, to prawdziwa jest równość
+
Co należało pokazać.<br/>
 
 
::<math>\sum_{n = 1}^{p - 1} S (n)^2 = {\small\frac{p - 1}{2}} (S (a)^2 + S (b)^2)</math>
 
 
 
Jak łatwo zauważyć <math>S(0) = 0</math>, zatem możemy napisać
 
 
 
::<math>\sum_{n = 0}^{p - 1} S (n)^2 = {\small\frac{p - 1}{2}} (S (a)^2 + S (b)^2)</math>
 
 
 
Z drugiej strony
 
 
 
::<math>S (n)^2 = \sum_{k = 1}^{p - 1} \left( {\small\frac{k (k^2 + n)}{p}} \right)_{\small{\!\! L}} \sum^{p - 1}_{j = 1} \left( {\small\frac{j (j^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
:::<math>\quad \,\, = \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k (k^2 + n)}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{j (j^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
:::<math>\quad \,\, = \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k j (k^2 + n) (j^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Zatem
 
 
 
::<math>\sum_{n = 0}^{p - 1} S (n)^2 = \sum_{n = 0}^{p - 1} \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k j (k^2 + n) (j^2 + n)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
:::::<math>\;\! = \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}} \sum_{n = 0}^{p - 1} \left( {\small\frac{(n + k^2) (n + j^2)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
 
 
Z twierdzenia K9 wiemy, że
 
 
 
::<math>\sum_{n = 0}^{p - 1} \left( {\small\frac{(n + k^2) (n + j^2)}{p}} \right)_{\small{\!\! L}} =
 
\begin{cases}
 
\;\;\:\,      - 1 & \text{gdy } \, p \nmid (k^2 - j^2) \\
 
    p - 1 & \text{gdy } \, p \mid (k^2 - j^2) \\
 
\end{cases}</math>
 
 
 
 
 
Zbadajmy, kiedy <math>p \mid (k^2 - j^2)</math>, czyli kiedy <math>p \mid [(k - j) (k + j)]</math>. Mamy
 
 
 
::* <math>\; 0 \leqslant | k - j | \leqslant p - 2</math>
 
 
 
::* <math>\; 2 \leqslant k + j \leqslant 2 p - 2</math>
 
 
 
Zatem <math>p \mid [(k - j) (k + j)]</math> gdy
 
 
 
::* <math>\; j = k</math>
 
 
 
::* <math>\; j = p - k</math>
 
 
 
 
 
Pozwala to zapisać rozpatrywaną sumę w&nbsp;postaci
 
 
 
::<math>\sum_{n = 0}^{p - 1} S (n)^2 = \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}} \cdot
 
\left\{ \begin{array}{rll}
 
  - 1  & \text{gdy } \; j \neq k \;\;\;\; \text{ i } \;\;\;\; j \neq p - k \\
 
  p - 1 & \text{gdy } \; j = k \;\; \text{ lub } \;\; j = p - k \\
 
\end{array} \right\}</math>
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
:::::<math>\:\! = (p - 1) \underset{j = k \; \text{ lub } \; j = p - k}{\sum^{p - 1}_{k = 1} \sum_{j = 1}^{p - 1}} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}} - \underset{j \neq k \; \text{ i } \; j \neq p - k}{\sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1}} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
:::::<math>\:\! = (p - 1) \left[ \sum_{k = 1}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 1} \left( {\small\frac{k (p - k)}{p}} \right)_{\small{\!\! L}} \right] - \sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}} + \underset{j = k \; \text{ lub } \; j = p - k}{\sum_{k = 1}^{p - 1} \sum_{j = 1}^{p - 1}} \left( {\small\frac{k j}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
:::::<math>\:\! = (p - 1) \left[ (p - 1) + \sum_{k = 1}^{p - 1} \left( {\small\frac{- k^2}{p}} \right)_{\small{\!\! L}} \right] - \sum_{k = 1}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \sum^{p - 1}_{j = 1} \left( {\small\frac{j}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 1} \left( {\small\frac{k (p - k)}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
:::::<math>\:\! = (p - 1) \left[ (p - 1) + \left( {\small\frac{-1}{p}} \right)_{\small{\!\! L}} \sum_{k = 1}^{p - 1} \left( {\small\frac{k^2}{p}} \right)_{\small{\!\! L}} \right] + (p - 1) + \sum_{k = 1}^{p - 1} \left( {\small\frac{- k^2}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
:::::<math>\:\! = (p - 1) \cdot 2 (p - 1) + (p - 1) + (p - 1)</math>
 
</div>
 
 
 
:::::<math>\:\! = 2 p (p - 1)</math>
 
 
 
Zauważmy, że <math>\left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} = 1</math>, bo <math>p = 4 k + 1</math>.
 
 
 
 
 
Ponieważ wcześniej pokazaliśmy, że
 
 
 
::<math>\sum_{n = 0}^{p - 1} S (n)^2 = {\small\frac{p - 1}{2}} (S (a)^2 + S (b)^2)</math>
 
 
 
to otrzymujemy
 
 
 
::<math>{\small\frac{p - 1}{2}} (S (a)^2 + S (b)^2) = 2 p (p - 1)</math>
 
 
 
Czyli
 
 
 
::<math>S (a)^2 + S (b)^2 = 4 p</math>
 
 
 
Wynika stąd, że bez względu na to, czy <math>n</math> jest liczbą kwadratową, czy liczbą niekwadratową modulo <math>p</math>, prawdziwe jest oszacowanie
 
 
 
::<math>| S (n) | \leqslant 2 \sqrt{p}</math>
 
 
 
Równość <math>S (n)^2 = 4 p</math> nie jest możliwa, bo dzielnik pierwszy <math>p</math> występuje po prawej stronie w&nbsp;potędze nieparzystej. Zatem mamy nieco silniejsze oszacowanie
 
 
 
::<math>| S (n) | < 2 \sqrt{p}</math>
 
 
 
Co kończy dowód.<br/>
 
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 531: Linia 326:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K13</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Zadanie M12</span><br/>
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>a, b \in \mathbb{Z}</math>, to dla sumy
+
Pokazać, że jeżeli <math>Q \in \mathbb{Z} \setminus \{ 0 \}</math> oraz <math>P = 4 Q + 1</math>, to
  
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_{2 k} (P, P Q) = P^k U_{2 k} (1, - Q)</math>
  
prawdziwe są następujące wzory
+
::<math>U_{2 k + 1} (P, P Q) = P^k V_{2 k + 1} (1, - Q)</math>
  
:: (a) <math>\;\; S(a, b) = - \left( {\small\frac{6 b}{p}} \right)_{\small{\!\! L}} \qquad \qquad \, \text{gdy } \; p \mid (4 a^3 + 27 b^2)</math>
+
::<math>V_{2 k} (P, P Q) = P^k V_{2 k} (1, - Q)</math>
  
:: (b) <math>\;\; | S (a, b) | < 2 \sqrt{p} \qquad \qquad \;\;\;\; \text{gdy } \; p \nmid (4 a^3 + 27 b^2)</math>
+
::<math>V_{2 k + 1} (P, P Q) = P^{k + 1} U_{2 k + 1} (1, - Q)</math>
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
Niech <math>p \geqslant 5</math>. W&nbsp;ogólnym przypadku interesująca nas suma ma postać
+
Niech
 
 
::<math>\sum_{t = 0}^{p - 1} \left( {\small\frac{a t^3 + b t^2 + c t + d}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
gdzie <math>p \nmid a</math>. Mnożąc licznik przez <math>a^2</math> nie zmieniamy wartości sumy
 
 
 
::<math>\sum_{t = 0}^{p - 1} \left( {\small\frac{a^3 t^3 + a^2 b t^2 + a^2 c t + a^2 d}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Podstawiając <math>x \equiv a t + r \!\! \pmod{p}</math>, dostajemy
 
 
 
::<math>\sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + x^2 (b - 3 r) + x [a c - r (2 b - 3 r)] + [a^2 d - a c r + r^2 (b - r)]}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
bo, gdy <math>t</math> przebiega zbiór <math>\{ 0, 1, \ldots, p - 1 \}</math>, to (modulo <math>p</math>) liczby <math>a t + r</math> przebiegają taki sam zbiór (zobacz C57). Ponieważ <math>p \geqslant 5</math>, to liczbę <math>r</math> możemy wybrać tak, aby było
 
 
 
::<math>3 r \equiv b \!\! \pmod{p}</math>
 
 
 
Ostatecznie otrzymujemy
 
 
 
::<math>\sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + x (a c - 3 r^2) + (a^2 d - a c r + 2 r^3)}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
 
 
Widzimy, że bez zmniejszania ogólności, możemy ograniczyć się do badania sumy postaci
 
 
 
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Liczbę <math>- \left( 4 a^3 + 27 b^2 \right)</math> nazywamy wyróżnikiem wielomianu <math>x^3 + a x + b</math>.
 
 
 
Pokażemy, że w&nbsp;przypadku, gdy <math>4 a^3 + 27 b^2 \equiv 0 \!\! \pmod{p}</math> i <math>p \geqslant 3</math> prawdziwy jest wzór
 
 
 
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}} = - \left( {\small\frac{6 b}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
 
 
W przypadku, gdy <math>p = 3</math> z&nbsp;warunku <math>4 a^3 + 27 b^2 \equiv 0 \pmod{3}</math> wynika, że <math>3 \mid a</math>. Zakładając, że reszta z&nbsp;dzielenia liczby <math>b</math> przez <math>3</math> wynosi <math>r</math>, otrzymujemy
 
 
 
::<math>S(a, b) = \sum_{x = 0}^{2} \left( {\small\frac{x^3 + b}{3}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{b}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{1 + b}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{8 + b}{3}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{r}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{r + 1}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{r + 2}{3}} \right)_{\small{\!\! L}}
 
= \left( {\small\frac{0}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{1}{3}} \right)_{\small{\!\! L}} + \left( {\small\frac{2}{3}} \right)_{\small{\!\! L}}
 
= 0</math>
 
 
 
 
 
Jeżeli <math>p \geqslant 5</math> i <math>p \mid a</math>, to <math>p \mid b</math> i&nbsp;łatwo znajdujemy, że
 
 
 
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}}
 
= \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3}{p}} \right)_{\small{\!\! L}}
 
= 0</math>
 
 
 
 
 
Jeżeli <math>p \geqslant 5</math> i <math>p \nmid a</math>, to
 
 
 
::<math>x^3 + a x + b \equiv (x - x_1) (x - x_2)^2 \!\! \pmod{p}</math>
 
 
 
gdzie
 
 
 
::<math>x_1 \equiv 3 b a^{- 1} \!\! \pmod{p}</math>
 
 
 
::<math>x_2 \equiv - 3 b 2^{- 1} a^{- 1} \!\! \pmod{p}</math>
 
 
 
Co Czytelnik może łatwo sprawdzić, pamiętając o&nbsp;tym, że <math>27 b^2 \cdot 2^{- 2} a^{- 3} \equiv - 1 \!\! \pmod{p}</math>. Mamy
 
 
 
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x - x_2}{p}} \right)_{\small{\!\! L}}^{\! 2} \left( {\small\frac{x - x_1}{p}} \right)_{\small{\!\! L}}</math>
 
  
Niech <math>t = x - x_2</math>. Jeżeli <math>x</math> przebiega zbiór <math>\{ 0, 1, \ldots, p - 1 \}</math>, to (modulo <math>p</math>) <math>t</math> przebiega taki sam zbiór (zobacz C57). Zatem
+
::<math>\alpha = {\small\frac{1 + \sqrt{P}}{2}} \qquad \qquad \beta = {\small\frac{1 - \sqrt{P}}{2}}</math>
  
::<math>S(a, b) = \sum_{t = 0}^{p - 1} \left( {\small\frac{t}{p}} \right)_{\small{\!\! L}}^{\! 2} \left( {\small\frac{t + x_2 - x_1}{p}} \right)_{\small{\!\! L}}
+
::<math>a = {\small\frac{P + \sqrt{P}}{2}} \qquad \qquad b = {\small\frac{P - \sqrt{P}}{2}}</math>
= \sum_{t = 1}^{p - 1} \left( {\small\frac{t + x_2 - x_1}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{x_2 - x_1}{p}} \right)_{\small{\!\! L}} + \sum_{t = 0}^{p - 1} \left( {\small\frac{t + x_2 - x_1}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{x_2 - x_1}{p}} \right)_{\small{\!\! L}}</math>
 
  
Uwzględniając, że
+
Liczby <math>\alpha, \beta</math> oraz <math>a, b</math> są odpowiednio pierwiastkami równań
  
::<math>x_2 - x_1 \equiv - 3 b 2^{- 1} a^{- 1} - 3 b a^{- 1} \equiv - 3 b 2^{- 1} a^{- 1} - 6 b 2^{- 1} a^{- 1} \equiv - 9 b 2^{- 1} a^{- 1} \!\! \pmod{p}</math>
+
::<math>x^2 - x - {\small\frac{P - 1}{4}} = 0</math>
  
otrzymujemy
+
::<math>x^2 - P x + {\small\frac{P (P - 1)}{4}} = 0</math>
  
::<math>S(a, b) = - \left( {\small\frac{x_2 - x_1}{p}} \right)_{\small{\!\! L}}
+
Z założenia <math>P = 4 Q + 1</math>, zatem
= - \left( {\small\frac{- 9 b 2^{- 1} a^{- 1}}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{- 2 a b}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{- 8 a^3 b}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{- 2 b \cdot (- 27 b^2)}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{6 b}{p}} \right)_{\small{\!\! L}}</math>
 
  
 +
::<math>x^2 - x - Q = 0</math>
  
W przypadku, gdy <math>4 a^3 + 27 b^2 \not\equiv 0 \!\! \pmod{p}</math>, pokażemy, że wartość sumy
+
::<math>x^2 - P x + P Q = 0</math>
  
::<math>S(a, b) = \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}}</math>
+
Czyli definiują one ciągi Lucasa
  
jest ściśle związana z&nbsp;ilością rozwiązań kongruencji
+
::<math>U_n (1, - Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad V_n (1, - Q) = \alpha^n + \beta^n</math>
  
::<math>y^2 \equiv x^3 + a x + b \!\! \pmod{p}</math>
+
::<math>U_n (P, P Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (P, P Q) = a^n + b^n</math>
  
 +
Zauważmy, że
  
Niech <math>N_p</math> oznacza ilość rozwiązań powyższej kongruencji i&nbsp;niech <math>N_+, N_0, N_-</math> oznaczają ilości liczb <math>k \in \{ 0, 1, \ldots, p - 1 \}</math>, dla których symbol Legendre'a <math>\left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}}</math> jest równy odpowiednio <math>+ 1, 0, - 1</math>. Oczywiście
+
::<math>\alpha - \beta = a - b = \sqrt{P}</math>
  
::<math>N_+ + N_0 + N_- = p</math>
+
::<math>{\small\frac{a}{\alpha}} = {\small\frac{P + \sqrt{P}}{1 + \sqrt{P}}} = \sqrt{P}</math>
  
::<math>S(a, b) = N_+ - N_-</math>
+
::<math>{\small\frac{b}{\beta}} = {\small\frac{P - \sqrt{P}}{1 - \sqrt{P}}} = - \sqrt{P}</math>
  
Zauważmy, że jeżeli dla pewnego <math>x</math> jest <math>p \mid (x^3 + a x + b)</math>, to <math>\left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}} = 0</math> i&nbsp;mamy dokładnie jedno rozwiązanie rozważanej kongruencji
 
  
::<math>0^2 \equiv x^3 + a x + b \!\! \pmod{p}</math>
+
Łatwo znajdujemy
  
Jeżeli dla pewnego <math>x</math> jest <math>\left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}} = + 1</math>, to <math>p \nmid (x^3 + a x + b)</math>, a&nbsp;liczba <math>x^3 + a x + b</math> jest liczbą kwadratową modulo <math>p</math>, czyli istnieje taka liczba <math>y \in \mathbb{Z}</math>, że
+
::<math>U_{2 k} (P, P Q) = \frac{a^{2 k} - b^{2 k}}{a - b} = \frac{\left( \alpha \sqrt{P} \right)^{2 k} - \left( - \beta \sqrt{P} \right)^{2 k}}{\sqrt{P}} = \frac{P^k (\alpha^{2 k} - \beta^{2 k})}{\alpha - \beta} = P^k U_{2 k} (1, - Q)</math>
  
::<math>y^2 \equiv x^3 + a x + b \!\! \pmod{p}</math>
 
  
i mamy dwa rozwiązania rozpatrywanej kongruencji: jedno stanowi para <math>(x, y)</math>, a&nbsp;drugie para <math>(x, - y)</math>. Zatem
+
::<math>U_{2 k + 1} (P, P Q) = \frac{a^{2 k + 1} - b^{2 k + 1}}{a - b} = \frac{\left( \alpha \sqrt{P} \right)^{2 k + 1} - \left( - \beta \sqrt{P} \right)^{2 k + 1}}{\sqrt{P}} = P^k (\alpha^{2 k + 1} + \beta^{2 k + 1}) = P^k V_{2 k + 1} (1, - Q)</math>
  
::<math>N_p = 2 N_+ + N_0</math>
 
  
Łatwo zauważamy, że
+
::<math>V_{2 k} (P, P Q) = a^{2 k} + b^{2 k} = \left( \alpha \sqrt{P} \right)^{2 k} + \left( - \beta \sqrt{P} \right)^{2 k} = P^k (\alpha^{2 k} + \beta^{2 k}) = P^k V_{2 k} (1, - Q)</math>
  
::<math>N_p - p = (2 N_+ + N_0) - (N_+ + N_0 + N_-) = N_+ - N_- = S (a, b)</math>
 
  
 
+
::<math>V_{2 k + 1} (P, P Q) = a^{2 k + 1} + b^{2 k + 1} = \left( \alpha \sqrt{P} \right)^{2 k + 1} + \left( - \beta \sqrt{P} \right)^{2 k + 1} = P^{k + 1} \cdot \frac{\alpha^{2 k + 1} - \beta^{2 k + 1}}{\sqrt{P}} = P^{k + 1} U_{2 k + 1} (1, - Q)</math>
W 1936 roku Helmut Hasse<ref name="Hasse1"/><ref name="Hasse2"/> udowodnił, że
 
 
 
::<math>| N_p - p | < 2 \sqrt{p}</math>
 
 
 
Elementarny dowód tego twierdzenia podał Jurij Manin<ref name="Manin1"/>.
 
 
 
 
 
Wynika stąd, że w&nbsp;przypadku, gdy <math>4 a^3 + 27 b^2 \not\equiv 0 \!\! \pmod{p}</math> prawdziwe jest oszacowanie
 
 
 
::<math>| S (a, b) | = \left| \sum_{x = 0}^{p - 1} \left( {\small\frac{x^3 + a x + b}{p}} \right)_{\small{\!\! L}} \right| < 2 \sqrt{p}</math>
 
  
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
Linia 675: Linia 390:
  
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K14</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M13</span><br/>
Pokazać, że jeżeli <math>p \geqslant 7</math> jest liczbą pierwszą, to wśród liczb <math>1, 2, \ldots, p - 1</math> istnieją:
+
Dla wyrazów ciągów Lucasa prawdziwe są wzory
  
:* dwie kolejne liczby będące liczbami kwadratowymi modulo <math>p</math>
+
{| class="wikitable plainlinks"  style="display: inline-table; margin-left: 5px; margin-right: 50px; font-size: 100%; text-align: left;"
:* dwie kolejne liczby będące liczbami niekwadratowymi modulo <math>p</math>
+
|-
 
+
| <math>1.</math> || <math>U_{m + n} = U_m U_{n + 1} - Q U_{m - 1} U_n</math> ||
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
|-
Dla <math>p = 7</math> łatwo sprawdzamy, że twierdzenie jest prawdziwe.
+
| <math>2.</math> || <math>V_{m + n} = V_m V_n - Q^n V_{m - n}</math> || <math>m \geqslant n</math>
 
+
|-
'''Punkt 1.'''
+
| <math>3.</math> || <math>U_{m + n} = U_m V_n - Q^n U_{m - n}</math> || <math>m \geqslant n</math>
 
+
|-
Zauważmy, że przynajmniej jedna z&nbsp;liczb <math>2, 5, 10</math> jest liczbą kwadratową. Zakładając, że tak nie jest, otrzymujemy natychmiast sprzeczność
+
| <math>4.</math> || <math>V_{m + n} = D U_m U_n + Q^n V_{m - n}</math> || <math>m \geqslant n</math>
 
 
::<math> -1 = \left( {\small\frac{10}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{5}{p}} \right)_{\small{\!\! L}} = (- 1) \cdot (- 1) = 1</math>
 
 
 
W zależności od tego, która z&nbsp;liczb <math>2, 5, 10</math> jest liczbą kwadratową, mamy następujące pary kolejnych liczb kwadratowych
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
 
 
|-
 
|-
| <math>2</math> || <math>1, 2 \; \text{ oraz } \; 8, 9</math>
+
| <math>5.</math> || <math>U_m V_n - V_m U_n = 2 Q^n U_{m - n}</math> || <math>m \geqslant n</math>
 
|-
 
|-
| <math>5</math> || <math>4, 5</math>
+
| <math>6.</math> || <math>U^2_n = U_{n - 1} U_{n + 1} + Q^{n - 1}</math> ||
 
|-
 
|-
| <math>10</math> || <math>9, 10</math>
+
| <math>7.</math> || <math>V^2_n = V_{n - 1} V_{n + 1} - D Q^{n - 1}</math> ||
 
|}
 
|}
 
+
{| class="wikitable plainlinks"  style="display: inline-table; margin-left: 5px; margin-right: 50px; font-size: 100%; text-align: left;"
'''Punkt 2.'''
+
|-
 
+
| <math>\;\; 8.</math> || <math>2 U_{m + n} = U_m V_n + V_m U_n</math> ||
Rozważmy wszystkie możliwe wartości <math>\left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}</math> dla <math>k = 1, 2, 3, 4</math> i <math>p \geqslant 11</math>. Zauważmy, że <math>\left( {\small\frac{6}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{3}{p}} \right)_{\small{\!\! L}}</math>.
+
|-
 
+
| <math>\;\; 9.</math> || <math>2 V_{m + n} = V_m V_n + D U_m U_n</math> ||
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
+
|-
 +
| <math>10.</math> || <math>V_m V_n - D U_m U_n = 2 Q^n V_{m - n}</math> || <math>m \geqslant n</math>
 +
|-
 +
| <math>11.</math> || <math>U_{2 n} = U_n V_n</math> ||
 +
|-
 +
| <math>12.</math> || <math>V_{2 n} = V^2_n - 2 Q^n</math> ||
 +
|-
 +
| <math>13.</math> || <math>V_{2 n} = D U^2_n + 2 Q^n</math> ||
 +
|-
 +
| <math>14.</math> || <math>V^2_n - D U^2_n = 4 Q^n</math> ||
 +
|-
 +
| <math>15.</math> || <math>D U_n = 2 V_{n + 1} - P V_n</math> ||
 +
|-
 +
| <math>16.</math> || <math>V_n = 2 U_{n + 1} - P U_n</math> ||
 
|-
 
|-
! <math>\boldsymbol{k}</math> || <math>\,\, \boldsymbol{1} \,\,</math> || <math>\boldsymbol{2}</math> || <math>\boldsymbol{3}</math> || <math>\,\, \boldsymbol{4} \,\,</math> || <math>\,\, \boldsymbol{5} \,\,</math> || <math>\boldsymbol{6}</math> || <math>\boldsymbol{(…)}</math> || <math>\boldsymbol{p-1}</math>
+
| <math>17.</math> || <math>D U_n = V_{n + 1} - Q V_{n - 1}</math> || <math>n \geqslant 1</math>
 
|-
 
|-
! <math>\boldsymbol{A.}</math>
+
| <math>18.</math> || <math>V_n = U_{n + 1} - Q U_{n - 1}</math> || <math>n \geqslant 1</math>
| <math>1</math> || <math>1</math> || <math>1</math> || <math>1</math> || <math></math> || <math>1</math> || <math></math> || <math></math>
+
|}
 +
{| class="wikitable plainlinks"  style="display: inline-table; margin-left: 5px; margin-right: 50px; font-size: 100%; text-align: left;"
 
|-
 
|-
! <math>\boldsymbol{B.}</math>
+
| <math>19.</math> || <math>U_{2 n} = 2 U_n U_{n + 1} - P U^2_n</math>
| <math>1</math> || <math>1</math> || <math>-1</math> || <math>1</math> || <math></math> || <math>-1</math> || <math></math> || <math></math>
 
 
|-
 
|-
! <math>\boldsymbol{C.}</math>
+
| <math>20.</math> || <math>U_{2 n + 1} = U^2_{n + 1} - Q U^2_n</math>
| <math>1</math> || <math>-1</math> || <math>1</math> || <math>1</math> || <math></math> || <math>-1</math> || <math></math> || <math></math>
 
 
|-
 
|-
! <math>\boldsymbol{D.}</math>
+
| <math>21.</math> || <math>U_{2 n + 2} = P U^2_{n + 1} - 2 Q U_n U_{n + 1}</math>
| <math>1</math> || <math>-1</math> || <math>-1</math> || <math>1</math> || <math></math> || <math>1</math> || <math></math> || <math></math>
 
 
|}
 
|}
 
'''A.''' W&nbsp;tym przypadku liczby <math>2, 3</math> są liczbami kwadratowymi modulo <math>p</math>. Gdyby w&nbsp;pozostałych komórkach miało nie być ani jednej pary kolejnych liczb niekwadratowych modulo <math>p</math>, to musielibyśmy <math>{\small\frac{p - 1}{2}}</math> liczb niekwadratowych umieścić wśród pozostałych <math>p - 5</math> komórek tak, aby między nimi zawsze była liczba kwadratowa modulo <math>p</math>. Wartość <math>\left( {\small\frac{6}{p}} \right)_{\small{\!\! L}}</math> wymusza, aby liczby niekwadratowe modulo <math>p</math> umieszczać w&nbsp;komórkach „nieparzystych”. Po wypełnieniu tych komórek pozostaną nam dwie liczby, które będziemy zmuszeni umieścić w&nbsp;komórkach „parzystych”. Co oznacza, że muszą pojawić się dwie pary kolejnych liczb niekwadratowych modulo <math>p</math>.
 
 
'''B. i&nbsp;C.''' W&nbsp;tym przypadku dokładnie jedna z&nbsp;liczb <math>2, 3</math> jest liczbą kwadratową modulo <math>p</math>. Gdyby w&nbsp;pozostałych komórkach miało nie być ani jednej pary kolejnych liczb niekwadratowych modulo <math>p</math>, to musielibyśmy <math>{\small\frac{p - 3}{2}}</math> liczb niekwadratowych umieścić wśród pozostałych <math>p - 5</math> komórek tak, aby między nimi zawsze była liczba kwadratowa modulo <math>p</math>. Wartość <math>\left( {\small\frac{6}{p}} \right)_{\small{\!\! L}}</math> wymusza, aby liczby niekwadratowe modulo <math>p</math> umieszczać w&nbsp;komórkach „parzystych”. Po wypełnieniu tych komórek pozostanie nam jedna liczba, którą będziemy zmuszeni umieścić w&nbsp;komórce „nieparzystej”. Co oznacza, że musi pojawić się jedna para kolejnych liczb niekwadratowych modulo <math>p</math>.
 
 
'''D.''' W&nbsp;tym przypadku nie musimy niczego dowodzić, bo liczby <math>2, 3</math> są kolejnymi liczbami niekwadratowymi modulo <math>p</math>.<br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K15</span><br/>
 
Wzmocnimy wynik uzyskany w&nbsp;poprzednim zadaniu. Zauważmy, jak użycie symbolu Legendre'a pozwala sformalizować problem.
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K16</span><br/>
 
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą, to
 
 
:* istnieje <math>\left\lfloor {\small\frac{p - 3}{4}} \right\rfloor</math> różnych par kolejnych liczb kwadratowych modulo <math>p</math>
 
:* istnieje <math>\left\lfloor {\small\frac{p - 1}{4}} \right\rfloor</math> różnych par kolejnych liczb niekwadratowych modulo <math>p</math>
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 +
'''Wzory 1. - 7. najłatwiej udowodnić korzystając z&nbsp;definicji M1.'''
  
'''Punkt 1.'''
+
Wzór 1.
  
Chcemy znaleźć ilość takich liczb <math>k \in \{ 1, 2, \ldots, p - 2 \}</math>, dla których
+
::<math>U_{m + n} = {\small\frac{\alpha^{m + n} - \beta^{m + n}}{\alpha - \beta}}</math>
  
::<math>\left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = 1</math>
+
:::<math>\quad \: = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot {\small\frac{\alpha^{n + 1} - \beta^{n + 1}}{\alpha - \beta}} - \alpha \beta \cdot {\small\frac{\alpha^{m - 1} - \beta^{m - 1}}{\alpha - \beta}} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}}</math>
  
Ilość liczb <math>k</math> spełniających powyższy warunek łatwo zapisać korzystając z&nbsp;symbolu Legendre'a
+
:::<math>\quad \: = U_m U_{n + 1} - Q U_{m - 1} U_n</math>
  
::<math>N = {\small\frac{1}{4}} \sum_{k = 1}^{p - 2} \left[ 1 + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \right] \left[ 1 + \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
 
  
Tylko w&nbsp;przypadku, gdy obie liczby <math>k</math> i <math>k + 1</math> są liczbami kwadratowymi modulo <math>p</math>, iloczyn wyrażeń w&nbsp;nawiasach kwadratowych jest różny od zera i&nbsp;równy <math>4</math> (stąd czynnik <math>{\small\frac{1}{4}}</math> przed sumą).
+
Wzór 2.
  
::<math>4 N = \sum_{k = 1}^{p - 2} \left[ 1 + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} + \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
::<math>V_{m + n} = \alpha^{m + n} + \beta^{m + n}</math>
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
:::<math>\quad \;\! = (\alpha^m + \beta^m) (\alpha^n + \beta^n) - \alpha^n \beta^n \cdot (\alpha^{m - n} + \beta^{m - n})</math>
:::<math>\: = p - 2 + \sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
  
Po kolei wyliczamy sumy po prawej stronie
+
:::<math>\quad \;\! = V_m V_n - Q^n V_{m - n}</math>
  
<div style="margin-top: 0em; margin-bottom: 1em;">
 
::<math>\sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{p - 1}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
Wzór 3.
::<math>\sum_{k = 1}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
= - \left( {\small\frac{1}{p}} \right)_{\small{\!\! L}} + \sum^{p - 1}_{k = 0} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
= - 1</math>
 
</div>
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
::<math>U_{m + n} = {\small\frac{\alpha^{m + n} - \beta^{m + n}}{\alpha - \beta}}</math>
::<math>\sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
= \sum_{k = 0}^{p - 1} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}  
 
= - 1</math>
 
</div>
 
  
(zobacz K7 i&nbsp;K9). Zatem
+
:::<math>\quad \: = {\small\frac{(\alpha^m - \beta^m) (\alpha^n + \beta^n)}{\alpha - \beta}} - {\small\frac{\alpha^n \beta^n \cdot (\alpha^{m - n} - \beta^{m - n})}{\alpha - \beta}}</math>
  
::<math>N = {\small\frac{1}{4}} \left[ p - 4 - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
:::<math>\quad \: = U_m V_n - Q^n U_{m - n}</math>
  
Czyli
 
  
::<math>N =
+
Wzór 4.
\begin{cases}
 
  {\large\frac{p - 5}{4}} & \text{ gdy } \; p = 4 k + 1 \\
 
  {\large\frac{p - 3}{4}} & \text{ gdy } \; p = 4 k + 3 \\
 
\end{cases}</math>
 
  
Powyższy wynik można zapisać w&nbsp;postaci
+
::<math>V_{m + n} = \alpha^{m + n} + \beta^{m + n}</math>
  
::<math>N = \left\lfloor {\small\frac{p - 3}{4}} \right\rfloor</math>
+
:::<math>\quad \;\! = (\alpha - \beta)^2 \cdot {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} + \alpha^n \beta^n \cdot (\alpha^{m - n} + \beta^{m - n})</math>
  
'''Punkt 2.'''
+
:::<math>\quad \;\! = D U_m U_n + Q^n V_{m - n}</math>
  
Chcemy znaleźć ilość takich liczb <math>k \in \{ 1, 2, \ldots, p - 2 \}</math>, dla których
 
  
::<math>\left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = - 1</math>
+
Wzór 5.
  
Ilość liczb <math>k</math> spełniających powyższy warunek łatwo zapisać korzystając z&nbsp;symbolu Legendre'a
+
::<math>U_m V_n - V_m U_n = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot (\alpha^n + \beta^n) - (\alpha^m + \beta^m) \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}}</math>
  
::<math>N = {\small\frac{1}{4}} \sum_{k = 1}^{p - 2} \left[ - 1 + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \right] \left[ - 1 + \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
::::::<math>\;\;\: = 2 \cdot \alpha^n \beta^n \cdot {\small\frac{\alpha^{m - n} - \beta^{m - n}}{\alpha - \beta}}</math>
  
Tylko w&nbsp;przypadku, gdy obie liczby <math>k</math> i <math>k + 1</math> są liczbami niekwadratowymi modulo <math>p</math>, iloczyn wyrażeń w&nbsp;nawiasach kwadratowych jest różny od zera i&nbsp;równy <math>4</math> (stąd czynnik <math>{\small\frac{1}{4}}</math> przed sumą).
+
::::::<math>\;\;\: = 2 Q^n U_{m - n}</math>
  
::<math>4 N = \sum_{k = 1}^{p - 2} \left[ 1 - \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} - \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
Wzór 6.
:::<math>\: = p - 2 - \sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} - \sum_{k = 1}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} + \sum_{k = 1}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}</math>
 
</div>
 
  
Wartości sum wyliczyliśmy już w&nbsp;punkcie 1. Zatem
+
::<math>U^2_n = \left( {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \right)^2</math>
  
::<math>N = {\small\frac{1}{4}} \left[ p - 2 + \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
:::<math>\;\! = {\small\frac{\alpha^{n - 1} - \beta^{n - 1}}{\alpha - \beta}} \cdot {\small\frac{\alpha^{n + 1} - \beta^{n + 1}}{\alpha - \beta}} + \alpha^{n - 1} \beta^{n - 1}</math>
  
Czyli
+
:::<math>\;\! = U_{n - 1} U_{n + 1} + Q^{n - 1}</math>
  
::<math>N =
 
\begin{cases}
 
  {\large\frac{p - 1}{4}} & \text{ gdy } \; p = 4 k + 1 \\
 
  {\large\frac{p - 3}{4}} & \text{ gdy } \; p = 4 k + 3 \\
 
\end{cases}</math>
 
  
Powyższy wynik można zapisać w&nbsp;postaci
+
Wzór 7.
  
::<math>N = \left\lfloor {\small\frac{p - 1}{4}} \right\rfloor</math>
+
::<math>V^2_n = (\alpha^n + \beta^n)^2</math>
  
Co należało pokazać.<br/>
+
:::<math>\;\! = (\alpha^{n - 1} + \beta^{n - 1}) (\alpha^{n + 1} + \beta^{n + 1}) - (\alpha - \beta)^2 \cdot \alpha^{n - 1} \beta^{n - 1}</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
:::<math>\;\! = V_{n - 1} V_{n + 1} - D Q^{n - 1}</math>
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K17</span><br/>
+
'''Wzory 8. - 18. można łatwo udowodnić, korzystając ze wzorów 1. - 7.'''
Niech <math>p</math> będzie liczbą pierwszą nieparzystą. Słowo „trójka” oznacza tutaj trzy kolejne liczby kwadratowe (niekwadratowe) modulo <math>p</math>.
 
  
Jeżeli <math>p = 4 k + 3</math>, to liczba różnych trójek liczb kwadratowych (niekwadratowych) jest równa
+
Wzór 8. Policzyć sumę wzoru 3. pomnożonego przez <math>2</math> i&nbsp;wzoru 5.
  
::<math>N = \left\lfloor {\small\frac{p - 3}{8}} \right\rfloor</math>
+
Wzór 9. Policzyć sumę wzorów 2. i 4.
  
Jeżeli <math>p = 4 k + 1</math>, to liczba różnych trójek liczb niekwadratowych jest równa
+
Wzór 10. Połączyć wzory 2. i 4.
  
::<math>N = {\small\frac{p - 3 - S (- 1)}{8}} > {\small\frac{p - 3 - 2 \sqrt{p}}{8}}</math>
+
Wzór 11. We wzorze 3. położyć <math>m = n</math>.
  
Jeżeli <math>p = 4 k + 1</math>, to liczba różnych trójek liczb kwadratowych jest równa
+
Wzór 12. We wzorze 2. położyć <math>m = n</math>.
  
::<math>N = {\small\frac{p - 15 + S (- 1)}{8}} > {\small\frac{p - 15 - 2 \sqrt{p}}{8}} \qquad \quad \text{ gdy } \; p = 8 k + 1</math>
+
Wzór 13. We wzorze 4. położyć <math>m = n</math>.
  
::<math>N = {\small\frac{p - 7 + S (- 1)}{8}} > {\small\frac{p - 7 - 2 \sqrt{p}}{8}} \qquad \quad \;\;\; \text{ gdy } \; p = 8 k + 5</math>
+
Wzór 14. We wzorze 10. położyć <math>m = n</math> lub połączyć wzory 12. i 13.
  
Gdzie przez <math>S(- 1)</math> oznaczyliśmy sumę
+
Wzór 15. We wzorze 9. położyć <math>m = 1</math>.
  
::<math>S(- 1) = \sum_{k = 0}^{p - 1} \left( {\small\frac{k (k^2 - 1)}{p}} \right)_{\small{\!\! L}}</math>
+
Wzór 16. We wzorze 8. położyć <math>m = 1</math>.
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
Wzór 17. We wzorze 15. położyć <math>V_{n + 1} = P V_n - Q V_{n - 1}</math>.
  
'''Przypadek pierwszy: trójki liczb kwadratowych modulo''' <math>\boldsymbol{p}</math>
+
Wzór 18. We wzorze 16. położyć <math>U_{n + 1} = P U_n - Q U_{n - 1}</math>.
  
Chcemy znaleźć ilość takich liczb <math>k \in \{ 2, 3, \ldots, p - 2 \}</math>, dla których
 
  
::<math>\left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = + 1</math>
+
'''Wzory 19. - 21. to wzory, które wykorzystamy w&nbsp;przyszłości do szybkiego obliczania wartości wyrazów <math>U_n</math> i <math>V_n</math> modulo.'''
  
Ilość liczb <math>k</math> spełniających powyższy warunek łatwo zapisać korzystając z&nbsp;symbolu Legendre'a
+
Wzór 19. Wystarczy połączyć wzory 11. oraz 16.
  
::<math>N = {\small\frac{1}{8}} \sum_{k = 2}^{p - 2} \left[ 1 + \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \right] \left[ 1 + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \right] \left[ 1 + \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
Wzór 20. Wystarczy we wzorze 1. położyć <math>m = n + 1</math>.
  
Tylko w&nbsp;przypadku, gdy wszystkie trzy liczby <math>k - 1, k, k + 1</math> są liczbami kwadratowymi modulo <math>p</math>, iloczyn wyrażeń w&nbsp;nawiasach kwadratowych jest różny od zera i&nbsp;równy <math>8</math> (stąd czynnik <math>{\small\frac{1}{8}}</math> przed sumą).
+
Wzór 21. Kładąc we wzorze 19. <math>n \rightarrow n + 1</math>, otrzymujemy
  
::<math>8 N = \sum_{k = 2}^{p - 2} \left[ 1
+
::<math>U_{2 n + 2} = 2 U_{n + 1} U_{n + 2} - P U^2_{n + 1} \qquad (*)</math>
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
\right]</math>
 
  
:::<math>\: = p - 3 + \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}}
+
Kładąc we wzorze 1. <math>m = n + 2</math>, mamy
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k (k^2 - 1)}{p}} \right)_{\small{\!\! L}}</math>
 
  
 +
::<math>U_{2 n + 2} = U_{n + 2} U_{n + 1} - Q U_{n + 1} U_n</math>
  
Po kolei wyliczamy sumy po prawej stronie
+
Czyli
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} = - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} - \left( {\small\frac{- 2}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>2 U_{2 n + 2} = 2 U_{n + 1} U_{n + 2} - 2 Q U_n U_{n + 1}</math>
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = - 1 - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}}</math>
+
Odejmując od powyższego wzoru wzór <math>(*)</math>, dostajemy wzór 21.
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = - 1 - \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}}</math>
+
::<math>U_{2 n + 2} = P U^2_{n + 1} - 2 Q U_n U_{n + 1}</math>
  
 +
Co należało pokazać.<br/>
 +
&#9633;
 +
{{\Spoiler}}
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = - 1 - \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}}</math>
 
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = - 1 - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}}</math>
 
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = - 1 - \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}}</math>
 
  
  
::<math>\sum_{k = 2}^{p - 2} \left( {\small\frac{k (k^2 - 1)}{p}} \right)_{\small{\!\! L}} = \sum^{p - 1}_{k = 0} \left( {\small\frac{k (k^2 - 1)}{p}} \right)_{\small{\!\! L}} = S (- 1)</math>
+
== Obliczanie wyrazów ciągu Lucasa modulo <math>m</math> ==
  
 +
<span style="font-size: 110%; font-weight: bold;">Przykład M14</span><br/>
 +
Pokażemy, jak wykorzystać podane w&nbsp;twierdzeniu M13 wzory 19, 20, 21 i 16
  
(zobacz K7, K9 i K12). Oznaczenie <math>S(- 1)</math> nawiązuje do oznaczenia wprowadzonego w&nbsp;twierdzeniu K12. Wykorzystamy też znalezione w&nbsp;tym twierdzeniu oszacowanie <math>| S (- 1) |</math>.
+
::<math>U_{2 n} = 2 U_n U_{n + 1} - P U^2_n</math>
  
Zatem
+
::<math>U_{2 n + 1} = U^2_{n + 1} - Q U^2_n</math>
  
::<math>8 N = p - 8 - 3 \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} - 3 \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} - \left( {\small\frac{- 2}{p}} \right)_{\small{\!\! L}} + S (- 1)</math>
+
::<math>U_{2 n + 2} = P U^2_{n + 1} - 2 Q U_n U_{n + 1}</math>
  
Jeżeli <math>p = 8 k + 1</math>
+
::<math>V_n = 2 U_{n + 1} - P U_n</math>
  
::<math>N = {\small\frac{p - 15 + S (- 1)}{8}} > {\small\frac{p - 15 - 2 \sqrt{p}}{8}}</math>
+
do szybkiego obliczania wyrazów ciągu Lucasa modulo <math>m</math>.
  
Jeżeli <math>p = 8 k + 3</math>
 
  
::<math>N = {\small\frac{p - 3}{8}}</math>
+
Niech <math>P = 3</math>, <math>Q = 1</math>, <math>D = P^2 - 4 Q = 5</math>, <math>n = 22 = (10110)_2 = \sum_{j = 0}^{4} a_j \cdot 2^j</math>.
  
Jeżeli <math>p = 8 k + 5</math>
+
W tabeli przedstawione są kolejne kroki, jakie musimy wykonać, aby policzyć <math>U_n = U_{22}</math> modulo <math>m = 23</math>.
  
::<math>N = {\small\frac{p - 7 + S (- 1)}{8}} > {\small\frac{p - 7 - 2 \sqrt{p}}{8}}</math>
+
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
 +
|-
 +
! <math>\boldsymbol{j}</math> !! <math>\boldsymbol{a_j}</math> !! <math>\boldsymbol{k_j}</math> !! <math>\boldsymbol{U_{k_j}}</math> !! <math>\boldsymbol{U_{k_j + 1}}</math>
 +
|-
 +
| <math>4</math> || <math>1</math> || <math>(1)_2 = 1</math> || <math>U_1 = 1</math> || <math>U_2 = P = 3</math>
 +
|-
 +
| <math>3</math> || <math>0</math> || <math>(10)_2 = 2</math> || <math>U_2 = 2 U_1 U_2 - 3 U^2_1 = 6 - 3 = 3</math> || <math>U_3 = U^2_2 - 1 = 8</math>
 +
|-
 +
| <math>2</math> || <math>1</math> || <math>(101)_2 = 5</math> || <math>U_5 = U^2_3 - U^2_2 = 64 - 9 = 55 \equiv 9</math> || <math>U_6 = 3 U_3^2 - 2 U_2 U_3 = 192 - 48 = 144 \equiv 6</math>
 +
|-
 +
| <math>1</math> || <math>1</math> || <math>(1011)_2 = 11</math> || <math>U_{11} = U^2_6 - U^2_5 \equiv 36 - 81 \equiv - 45 \equiv 1</math> || <math>U_{12} = 3 U_6^2 - 2 U_5 U_6 \equiv 108 - 108 \equiv 0</math>
 +
|-
 +
| <math>0</math> || <math>0</math> || <math>(10110)_2 = 22</math> || <math>U_{22} = 2 U_{11} U_{12} - 3 U^2_{11} \equiv 0 - 3 \equiv 20</math> || <math>U_{23} = U^2_{12} - U^2_{11} \equiv 0 - 1 \equiv 22</math>
 +
|}
  
Jeżeli <math>p = 8 k + 7</math>
+
W kolumnie <math>a_j</math> wypisujemy kolejne cyfry liczby <math>n = 22 = (10110)_2</math> zapisanej w&nbsp;układzie dwójkowym. Liczby w&nbsp;kolumnie <math>k_j</math> tworzymy, biorąc kolejne (od prawej do lewej) cyfry liczby <math>n</math> w&nbsp;zapisie dwójkowym. Postępując w&nbsp;ten sposób, w&nbsp;ostatnim wierszu mamy <math>k_j = n</math> i&nbsp;wyliczamy liczby <math>U_n</math> i <math>U_{n + 1}</math> modulo <math>m</math>.
  
::<math>N = {\small\frac{p - 7}{8}}</math>
+
Dla uproszczenia zapisu i&nbsp;ułatwienia zrozumienia liczbę <math>k_j</math> oznaczymy jako <math>r</math>, a <math>k_{j + 1}</math> jako <math>s</math>. Zauważmy, że
  
 +
:* tabela jest zbudowana tak, że musimy znaleźć wyrazy ciągu Lucasa o&nbsp;indeksie <math>r = k_j</math> oraz o&nbsp;indeksie o&nbsp;jeden większym: <math>r + 1 = k_j + 1</math>
 +
:* przejście do następnego wiersza (w dół) oznacza, że musimy znaleźć wyrazy o&nbsp;indeksie <math>s = k_{j + 1}</math> oraz o&nbsp;indeksie o&nbsp;jeden większym: <math>s + 1</math>
 +
:* przechodząc do następnego wiersza, dotychczasowa liczba <math>r = k_j</math> powiększa się o&nbsp;kolejną cyfrę ( <math>0</math> lub <math>1</math> ), którą dopisujemy z&nbsp;prawej strony
 +
:* dodanie na końcu liczby <math>r = k_j</math> zera podwaja liczbę <math>r</math>, czyli <math>s = k_{j + 1} = 2 r</math> oraz <math>s + 1 = 2 r + 1</math>
 +
:* dodanie na końcu liczby <math>r = k_j</math> jedynki podwaja liczbę <math>r</math> i&nbsp;zwiększą ją o&nbsp;jeden, czyli <math>s = k_{j + 1} = 2 r + 1</math> oraz <math>s + 1 = 2 r + 2</math>
  
'''Przypadek drugi: trójki liczb niekwadratowych modulo''' <math>\boldsymbol{p}</math>
 
  
Chcemy znaleźć ilość takich liczb <math>k \in \{ 2, 3, \ldots, p - 2 \}</math>, dla których
+
Dlatego, jeżeli kolejną dodaną cyfrą jest zero, to korzystamy ze wzorów
  
::<math>\left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} = - 1</math>
+
::<math>U_s = U_{2 r} = 2 U_r U_{r + 1} - P U^2_r</math>
  
Ilość liczb <math>k</math> spełniających powyższy warunek łatwo zapisać korzystając z&nbsp;symbolu Legendre'a
+
::<math>U_{s + 1} = U_{2 r + 1} = U^2_{r + 1} - Q U^2_r</math>
  
::<math>N = - {\small\frac{1}{8}} \sum_{k = 2}^{p - 2} \left[ - 1 + \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \right] \left[ - 1 + \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \right] \left[ - 1 + \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}} \right]</math>
+
Gdy kolejną dodaną cyfrą jest jeden, to stosujemy wzory
  
Tylko w&nbsp;przypadku, gdy wszystkie trzy liczby <math>k - 1, k, k + 1</math> są liczbami niekwadratowymi modulo <math>p</math>, iloczyn wyrażeń w&nbsp;nawiasach kwadratowych jest różny od zera i&nbsp;równy <math>- 8</math> (stąd czynnik <math>- {\small\frac{1}{8}}</math> przed sumą).
+
::<math>U_s = U_{2 r + 1} = U^2_{r + 1} - Q U^2_r</math>
  
::<math>8 N = \sum_{k = 2}^{p - 2} \left[ 1
+
::<math>U_{s + 1} = U_{2 r + 2} = P U^2_{r + 1} - 2 Q U_r U_{r + 1}</math>
- \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}}
 
- \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
- \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
- \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
\right]</math>
 
  
:::<math>\: = p - 3 - \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}}
 
- \sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
- \sum_{k = 2}^{p - 2} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k - 1}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
+ \sum_{k = 2}^{p - 2} \left( {\small\frac{k}{p}} \right)_{\small{\!\! L}} \left( {\small\frac{k + 1}{p}} \right)_{\small{\!\! L}}
 
- \sum_{k = 2}^{p - 2} \left( {\small\frac{k (k^2 - 1)}{p}} \right)_{\small{\!\! L}}</math>
 
  
 +
Korzystając ze wzoru <math>V_n = 2 U_{n + 1} - P U_n</math>, mamy
  
Wartości sum już policzyliśmy, rozpatrując przypadek liczb kwadratowych modulo <math>p</math>. Zatem
+
::<math>V_{22} = 2 U_{23} - 3 U_{22} \equiv 44 - 60 \equiv - 16 \equiv 7 \pmod{23}</math>
  
::<math>8 N = p - 4 + \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! L}} - \left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} + \left( {\small\frac{- 2}{p}} \right)_{\small{\!\! L}} - S (- 1)</math>
+
Ostatecznie otrzymujemy
  
 +
::<math>U_{22} \equiv 20 \pmod{23} \quad</math> oraz <math>\quad V_{22} \equiv 7 \pmod{23}</math>
  
Jeżeli <math>p = 8 k + 1</math>
 
  
::<math>N = {\small\frac{p - 3 - S (- 1)}{8}} > {\small\frac{p - 3 - 2 \sqrt{p}}{8}}</math>
 
  
Jeżeli <math>p = 8 k + 3</math>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M15</span><br/>
 +
Uogólniając postępowanie przedstawione w&nbsp;przykładzie M14, możemy napisać program w&nbsp;PARI/GP do szybkiego obliczania wyrazów ciągu Lucasa <math>U_n (P, Q)</math> i <math>V_n (P, Q)</math> modulo <math>m</math>.
  
::<math>N = {\small\frac{p - 3}{8}}</math>
+
<span style="font-size: 90%; color:black;">modLucas(n, P, Q, m) =
 +
{
 +
'''local'''(A, i, s, U, U2, V, W, W2);
 +
'''if'''( m == 1, '''return'''([0, 0]) );
 +
'''if'''( n == 0, '''return'''([0, 2 % m]) );
 +
A = '''digits'''(n, 2); \\ otrzymujemy wektor cyfr liczby n w układzie dwójkowym
 +
s = '''length'''(A); \\ długość wektora A
 +
U = 1;
 +
W = P;
 +
i = 1;
 +
'''while'''( i++ <= s,
 +
        '''if'''( A[i] == 0,  U2 = 2*U*W - P*U^2;  W2 = W^2 - Q*U^2 );
 +
        '''if'''( A[i] == 1,  U2 = W^2 - Q*U^2;  W2 = P*W^2 - 2*Q*U*W );
 +
        U = U2 % m;
 +
        W = W2 % m;
 +
      );
 +
V = (2*W - P*U) % m;
 +
'''return'''([U, V]);
 +
}</span>
  
Jeżeli <math>p = 8 k + 5</math>
 
  
::<math>N = {\small\frac{p - 3 - S (- 1)}{8}} > {\small\frac{p - 3 - 2 \sqrt{p}}{8}}</math>
 
  
Jeżeli <math>p = 8 k + 7</math>
 
  
::<math>N = {\small\frac{p - 7}{8}}</math>
 
  
Co kończy dowód.<br/>
+
== Podzielność wyrazów <math>U_n (P, Q)</math> przez liczbę pierwszą nieparzystą ==
&#9633;
 
{{\Spoiler}}
 
  
 +
<span style="font-size: 110%; font-weight: bold;">Uwaga M16</span><br/>
 +
Niech <math>p</math> będzie liczbą pierwszą nieparzystą. W&nbsp;przypadku, gdy <math>p \nmid P Q</math> nie możemy nic powiedzieć o&nbsp;podzielności wyrazów <math>U_n</math> przez <math>p</math>. Przykładowo, jeżeli <math>P \equiv 1 \pmod{p} \;</math> <math>\text{i} \;\; Q \equiv 1 \pmod{p}</math>, to modulo <math>p</math>, mamy
  
 +
::<math>(U_n) \equiv (0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, \ldots)</math>
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K18</span><br/>
+
W przypadku, gdy <math>P \equiv 2 \pmod{p} \;</math> <math>\text{i} \;\; Q \equiv 1 \pmod{p}</math>, to modulo <math>p</math> mamy
Korzystając z&nbsp;twierdzenia K17, łatwo można pokazać, że każda liczba pierwsza <math>p \geqslant 19</math> ma co najmniej dwie różne trójki kolejnych liczb kwadratowych modulo <math>p</math> i&nbsp;co najmniej dwie różne trójki kolejnych liczb niekwadratowych modulo <math>p</math>.
 
  
 +
::<math>(U_n) \equiv (0, 1, 2, \ldots, p - 1, 0, 1, 2, \ldots, p - 1, 0, 1, 2, \ldots, p - 1, \ldots)</math>
  
 +
Sytuacja wygląda inaczej, gdy <math>p \mid P Q</math>.
  
  
  
== Najmniejsze liczby niekwadratowe modulo ==
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M17</span><br/>
 +
Niech <math>p</math> będzie liczbą pierwszą nieparzystą.
  
&nbsp;<br/>
+
::{| border="0"
 
+
|-style=height:1.9em
{| style="border-spacing: 5px; border: 2px solid black; background: transparent;"
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>\; p \mid P \;</math> <math>\text{i} \;\; p \mid Q , \;</math> to <math>\; p \mid U_n \;</math> dla <math>n \geqslant 2</math>
| &nbsp;'''A.''' Najmniejsze dodatnie liczby niekwadratowe modulo <math>p</math>&nbsp;
+
|-style=height:1.9em
|}
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>\; p \mid P \;</math> <math>\text{i} \;\; p \nmid Q , \;</math> to <math>\; p \mid U_{2 n} \;</math> i <math>\; p \nmid U_{2 n + 1}</math>
 
+
|-style=height:1.9em
<span style="font-size: 110%; font-weight: bold;">Przykład K19</span><br/>
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>\; p \nmid P \;</math> <math>\text{i} \;\; p \mid Q , \;</math> to <math>\; p \nmid U_n \;</math> dla <math>n \geqslant 1</math>
W tabeli przedstawiliśmy najmniejsze dodatnie liczby niekwadratowe modulo <math>p</math>
+
|-style=height:1.9em
 
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>\; p \mid Q , \;</math> to <math>\; p \mid U_n</math>, gdzie <math>n \geqslant 2</math>, wtedy i&nbsp;tylko wtedy, gdy <math>\; p \mid P</math>
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
+
|-style=height:1.9em
! <math>\boldsymbol{m}</math>  
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>\; p \nmid P \;</math> <math>\text{i} \;\; p \mid D , \;</math> to <math>\; p \mid U_n \;</math> wtedy i&nbsp;tylko wtedy, gdy <math>p \mid n</math>
| <math>3</math> || <math>5</math> || <math>7</math> || <math>9</math> || <math>11</math> || <math>13</math> || <math>15</math> || <math>17</math> || <math>19</math> || <math>21</math> || <math>23</math> || <math>25</math> || <math>27</math> || <math>29</math> || <math>31</math> || <math>33</math> || <math>35</math> || <math>37</math> || <math>39</math> || <math>41</math> || <math>43</math> || <math>45</math> || <math>47</math> || <math>49</math> || <math>51</math>
 
|-
 
<math>\boldsymbol{\mathbb{n}( p )}</math>  
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>2</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math>
 
 
|}
 
|}
  
 
+
Założenie, że <math>p \nmid P</math> w&nbsp;ostatnim punkcie jest istotne. Gdy <math>\; p \mid P \;</math> i <math>\; p \mid D , \;</math> to <math>\; p \mid Q \;</math> i&nbsp;otrzymujemy punkt pierwszy.
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K20</span><br/>
 
Do wyszukiwania liczb <math>\mathbb{n} = \mathbb{n} (p)</math> Czytelnik może wykorzystać prostą funkcję napisaną w&nbsp;PARI/GP
 
 
 
<span style="font-size: 90%; color:black;">A(p) =
 
{
 
'''if'''( p == 2, '''return'''(0) );
 
'''if'''( !'''isprime'''(p), '''return'''(0) );
 
'''forprime'''(q = 2, p, '''if'''( jacobi(q, p) == -1, '''return'''(q) ));
 
}</span>
 
 
 
Zauważmy, że choć wyliczamy symbol Jacobiego, to jest to w&nbsp;rzeczywistości symbol Legendre'a, '''bo wiemy''', że liczba <math>p</math> jest liczbą pierwszą (w przypadku, gdy <math>p</math> jest liczbą złożoną, funkcja zwraca zero).
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K21</span><br/>
 
Niech <math>\mathbb{n} \in \mathbb{Z}_+</math> i&nbsp;niech <math>p</math> będzie liczbą pierwszą nieparzystą. Jeżeli <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math>, to jest liczbą pierwszą.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Przypuśćmy, że <math>\mathbb{n} = a b</math> jest liczbą złożoną, gdzie <math>1 < a, b < \mathbb{n}</math>. Z&nbsp;założenia <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math>, zatem liczby <math>a, b</math> są liczbami kwadratowymi modulo <math>p</math>. Z&nbsp;definicji liczb kwadratowych muszą istnieć takie liczby <math>r, s</math>, że
+
'''Punkt 1.'''
  
::<math>r^2 \equiv a \pmod{p}</math>
+
Ponieważ <math>U_2 = P</math>, zatem <math>p \mid U_2</math>. Dla <math>n \geqslant 3</math> wyrażenie <math>U_n = P U_{n - 1} - Q U_{n - 2}</math> jest podzielne przez <math>p</math>.
  
::<math>s^2 \equiv b \pmod{p}</math>
+
'''Punkt 2.'''
 
 
Skąd wynika, że
 
  
::<math>\mathbb{n} = a b \equiv (r s)^2 \pmod{p}</math>
+
Indeksy parzyste. Indukcja matematyczna. Mamy <math>U_0 = 0</math> i <math>U_2 = P</math>, zatem <math>p \mid U_0</math> i <math>p \mid U_2</math>. Zakładając, że <math>p \mid U_{2 n}</math>, z definicji ciągu <math>(U_k)</math>, otrzymujemy dla <math>U_{2 n + 2}</math>
  
Wbrew założeniu, że <math>\mathbb{n}</math> jest liczbą niekwadratową modulo <math>p</math>.<br/>
+
::<math>U_{2 n + 2} = P U_{2 n - 1} - Q U_{2 n}</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
Z założenia indukcyjnego wynika, że <math>p \mid U_{2 n + 2}</math>, zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich <math>n \geqslant 0</math>.
  
 +
Indeksy nieparzyste. Indukcja matematyczna. Mamy <math>U_1 = 1</math> i <math>U_3 = P^2 - Q</math>, zatem <math>p \nmid U_1</math> i <math>p \nmid U_3</math>. Zakładając, że <math>p \nmid U_{2 n - 1}</math>, z definicji ciągu <math>(U_k)</math>, otrzymujemy dla <math>U_{2 n + 1}</math>
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K22</span><br/>
+
::<math>U_{2 n + 1} = P U_{2 n} - Q U_{2 n - 1}</math>
Pokazać, że najmniejszą liczbą niekwadratową modulo <math>p</math> jest
 
  
:* &nbsp;liczba <math>2</math> wtedy i&nbsp;tylko wtedy, gdy <math>p = 8 k \pm 3</math>
+
Z założenia indukcyjnego wynika, że <math>p \nmid U_{2 n + 1}</math>, zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich <math>n \geqslant 1</math>.
:* &nbsp;liczba <math>3</math> wtedy i&nbsp;tylko wtedy, gdy <math>p = 24 k \pm 7</math>
 
:* &nbsp;liczba <math>\geqslant 5</math> wtedy i&nbsp;tylko wtedy, gdy <math>p = 24 k \pm 1</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
'''Punkt 3.'''
Z właściwości symbolu Legendre'a (zobacz J31 p.7) wiemy, że
 
  
::<math>\left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} \,\, =  
+
Indukcja matematyczna. Mamy <math>U_1 = 1</math> i <math>U_2 = P</math>, zatem <math>p \nmid U_1</math> i <math>p \nmid U_2</math>. Zakładając, że <math>p \nmid U_n</math> zachodzi dla wszystkich liczb całkowitych dodatnich nie większych od <math>n</math>, z&nbsp;definicji ciągu <math>(U_n)</math>
\,\,
+
otrzymujemy dla <math>n + 1</math>
  \begin{cases}
 
\;\;\: 1 & \text{gdy } p \equiv 1, 7 \pmod{8} \\
 
      - 1 & \text{gdy } p \equiv 3, 5 \pmod{8}
 
  \end{cases}</math>
 
  
Wynika stąd natychmiast, dla liczb pierwszych <math>p</math> postaci <math>8 k \pm 3</math> (i tylko dla takich liczb) liczba <math>2</math> jest liczbą niekwadratową, czyli również najmniejszą liczbą niekwadratową modulo <math>p</math>.
+
::<math>U_{n + 1} = P U_n - Q U_{n - 1}</math>
  
Z zadania J43 wynika, że liczba <math>3</math> jest liczbą niekwadratową jedynie dla liczb pierwszych postaci <math>12 k \pm 5</math>. Zatem dla liczb pierwszych, które są jednocześnie postaci <math>p = 8 k \pm 1</math> i <math>p = 12 j \pm 5</math>, liczba <math>3</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math>. Z&nbsp;czterech warunków
+
Z założenia indukcyjnego wynika, że <math>p \nmid U_{n + 1}</math>, zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich liczb <math>n \geqslant 1</math>.
  
::<math>p = 8 k + 1 \quad \text{i} \quad p = 12 j + 5</math>
+
'''Punkt 4.'''
  
::<math>p = 8 k + 1 \quad \text{i} \quad p = 12 j + 7</math>
+
Wynika z&nbsp;punktów pierwszego i&nbsp;trzeciego.
  
::<math>p = 8 k + 7 \quad \text{i} \quad p = 12 j + 5</math>
+
'''Punkt 5.'''
  
::<math>p = 8 k + 7 \quad \text{i} \quad p = 12 j + 7</math>
+
Z twierdzenia M7 wiemy, że
  
Drugi i&nbsp;trzeci nie są możliwe, bo modulo <math>4</math> otrzymujemy
+
::<math>2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k</math>
  
::<math>p \equiv 1 \pmod{4} \quad \text{i} \quad p \equiv 3 \pmod{4}</math>
+
::::<math>\;\; = n P^{n - 1} + \binom{n}{3} P^{n - 3} D + \binom{n}{5} P^{n - 5} D^2 + \ldots +
 
+
\begin{cases}
::<math>p \equiv 3 \pmod{4} \quad \text{i} \quad p \equiv 1 \pmod{4}</math>
+
n P D^{(n - 2) / 2} & \text{gdy }n\text{ jest parzyste} \\
 
+
D^{(n - 1) / 2} & \text{gdy }n\text{ jest nieparzyste}
a z&nbsp;pierwszego i&nbsp;czwartego mamy
+
\end{cases}</math>
  
::<math>3 p = 24 k + 3 \quad \text{i} \quad 2 p = 24 j + 10 \qquad \;\: \Longrightarrow \qquad p = 24 (k - j) - 7 \qquad \Longrightarrow \qquad p \equiv - 7 \pmod{24}</math>
+
Z założenia <math>p \mid D</math>, zatem modulo <math>p</math> dostajemy
  
::<math>3 p = 24 k + 21 \quad \text{i} \quad 2 p = 24 j + 14 \qquad \Longrightarrow \qquad p = 24 (k - j) + 7 \qquad \Longrightarrow \qquad p \equiv 7 \pmod{24}</math>
+
::<math>2^{n - 1} U_n \equiv n P^{n - 1} \pmod{p}</math>
 
 
Zauważmy, że problem mogliśmy zapisać w&nbsp;postaci układu kongruencji
 
 
 
::<math>p \equiv \pm 1 \pmod{8}</math>
 
 
 
::<math>p \equiv \pm 5 \pmod{12}</math>
 
 
 
Gdyby moduły tych kongruencji były względnie pierwsze, to każdemu wyborowi znaków odpowiadałaby pewna kongruencja równoważna (zobacz J3). Widzimy, że w&nbsp;przypadku, gdy moduły nie są względnie pierwsze, kongruencja równoważna może istnieć, ale nie musi. Rozwiązując taki problem, wygodnie jest skorzystać z&nbsp;programu PARI/GP. Wystarczy wpisać
 
 
 
chinese(Mod(1, 8), Mod(5, 12)) = Mod(17, 24)
 
chinese(Mod(1, 8), Mod(-5, 12)) - błąd
 
chinese(Mod(-1, 8), Mod(5, 12)) - błąd
 
chinese(Mod(-1, 8), Mod(-5, 12)) = Mod(7, 24)
 
 
 
Ostatni punkt zadania rozwiążemy tą metodą. Liczba większa lub równa <math>5</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math> wtedy i&nbsp;tylko wtedy, gdy liczby <math>2</math> i <math>3</math> są liczbami kwadratowymi modulo <math>p</math>, co oznacza, że liczba pierwsza <math>p</math> spełnia kongruencje
 
 
 
::<math>p \equiv \pm 1 \pmod{8}</math>
 
 
 
::<math>p \equiv \pm 1 \pmod{12}</math>
 
 
 
Postępując jak wyżej, otrzymujemy
 
 
 
chinese(Mod(1, 8), Mod(1, 12)) = Mod(1, 24)
 
chinese(Mod(1, 8), Mod(-1, 12)) - błąd
 
chinese(Mod(-1, 8), Mod(1, 12)) - błąd
 
chinese(Mod(-1, 8), Mod(-1, 12)) = Mod(23, 24)
 
  
 +
Ponieważ <math>p \nmid P</math>, zatem <math>p \mid U_n</math> wtedy i&nbsp;tylko wtedy, gdy <math>p \mid n</math>.
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
 
&#9633;
 
&#9633;
Linia 1128: Linia 747:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K23</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M18</span><br/>
Dla każdej liczby pierwszej <math>p_n</math> istnieje nieskończenie wiele takich liczb pierwszych <math>q</math>, że <math>p_n</math> jest najmniejszą liczbą niekwadratową modulo <math>q</math>.
+
Jeżeli <math>d</math> jest nieparzystym dzielnikiem <math>Q</math>, to dla <math>n \geqslant 2</math> jest
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Niech <math>2, p_2, \ldots, p_{n - 1}, p_n</math> będą kolejnymi liczbami pierwszymi. Wybierzmy liczbę <math>u</math> tak, aby spełniała układ kongruencji
 
 
 
::<math>\begin{align}
 
u & \equiv 1 \pmod{8 p_2 \cdot \ldots \cdot p_{n - 1}} \\
 
u & \equiv a \pmod{p_n}
 
\end{align}</math>
 
  
gdzie <math>a</math> oznacza dowolną liczbą niekwadratową modulo <math>p_n</math>. Na podstawie chińskiego twierdzenia o&nbsp;resztach (zobacz J3) powyższy układ kongruencji może być zapisany w&nbsp;postaci kongruencji równoważnej
+
::<math>U_n \equiv P^{n - 1} \pmod{d}</math>
  
::<math>u \equiv c \pmod{8 p_2 \cdot \ldots \cdot p_n}</math>
+
W szczególności, gdy liczba pierwsza nieparzysta <math>p</math> jest dzielnikiem <math>Q</math> i <math>p \nmid P</math>, to
  
 
+
::<math>U_p \equiv 1 \pmod{p}</math>
Zauważmy, że żadna z&nbsp;liczb pierwszych <math>p_k</math>, gdzie <math>1 \leqslant k \leqslant n</math> nie dzieli liczby <math>c</math>, bo mielibyśmy
 
 
 
::<math>u \equiv 0 \pmod{p_k}</math>
 
 
 
wbrew wypisanemu wyżej układowi kongruencji. Zatem <math>\gcd (c, 8 p_2 \cdot \ldots \cdot p_n) = 1</math> i&nbsp;z&nbsp;twierdzenia Dirichleta (zobacz C27) wiemy, że wśród liczb <math>u</math> spełniających kongruencję <math>u \equiv c \!\! \pmod{8 p_2 \cdot \ldots \cdot p_n}</math> występuje nieskończenie wiele liczb pierwszych (bo wśród tych liczb są liczby postaci <math>8 p_2 \cdot \ldots \cdot p_n \cdot k + c</math>, gdzie <math>k \in \mathbb{Z}_+</math>). Oznaczmy przez <math>q</math> dowolną z&nbsp;tych liczb pierwszych.
 
 
 
 
 
Ponieważ <math>q \equiv 1 \!\! \pmod{8}</math>, to <math>\left( {\small\frac{2}{q}} \right)_{\small{\!\! L}} = 1</math> (zobacz J31), a&nbsp;dla wszystkich liczb pierwszych nieparzystych <math>p_k < p_n</math> mamy
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
::<math>\left( {\small\frac{p_k}{q}} \right)_{\small{\!\! L}} = \left( {\small\frac{q}{p_k}} \right)_{\small{\!\! L}} \cdot (- 1)^{\tfrac{q - 1}{2} \cdot \tfrac{p_k - 1}{2}} = \left( {\small\frac{q}{p_k}} \right)_{\small{\!\! L}} = \left( {\small\frac{c}{p_k}} \right)_{\small{\!\! L}} = \left( {\small\frac{1}{p_k}} \right)_{\small{\!\! L}} = 1</math>
 
</div>
 
 
 
bo <math>8 \mid (q - 1)</math>. Dla liczby pierwszej <math>p_n</math> jest
 
 
 
<div style="margin-top: 1em; margin-bottom: 1em;">
 
::<math>\left( {\small\frac{p_n}{q}} \right)_{\small{\!\! L}} = \left( {\small\frac{q}{p_n}} \right)_{\small{\!\! L}} \cdot (- 1)^{\tfrac{q - 1}{2} \cdot \tfrac{p_n - 1}{2}} = \left( {\small\frac{q}{p_n}} \right)_{\small{\!\! L}} = \left( {\small\frac{c}{p_n}} \right)_{\small{\!\! L}} = \left( {\small\frac{a}{p_n}} \right)_{\small{\!\! L}} = - 1</math>
 
</div>
 
 
 
Zatem wszystkie liczby pierwsze mniejsze od <math>p_n</math> są liczbami kwadratowymi modulo <math>q</math>, a&nbsp;liczba pierwsza <math>p_n</math> jest najmniejszą liczbą niekwadratową modulo <math>q</math>. Zauważmy, że <math>q</math> była dowolnie wybraną liczbą pierwszą z&nbsp;nieskończenie wielu liczb pierwszych występujących w&nbsp;ciągu arytmetycznym <math>8 p_2 \cdot \ldots \cdot p_n \cdot k + c</math>, gdzie <math>k \in \mathbb{Z}_+</math>. Co kończy dowód.<br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K24 (Sarvadaman Chowla)</span><br/>
 
Istnieje niekończenie wiele liczb pierwszych <math>p</math> takich, że najmniejsza liczba niekwadratowa modulo <math>p</math> jest większa od <math>{\small\frac{\log p}{2 L \log 2}}</math>, gdzie <math>L</math> jest stałą Linnika.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Niech <math>a = 4 P (m)</math>, gdzie <math>P(m)</math> jest iloczynem wszystkich liczb pierwszych nie większych od <math>m</math>. Z&nbsp;twierdzenia Dirichleta (zobacz C27) wiemy, że w&nbsp;ciągu arytmetycznym <math>u_k = a k + 1</math> występuje nieskończenie wiele liczb pierwszych. Niech <math>p</math> oznacza dowolną z&nbsp;nich.
+
Oznaczmy <math>\delta = \sqrt{D}</math>, zatem <math>2 \alpha = P + \delta</math> i <math>2 \beta = P - \delta</math>. Ze wzoru dwumianowego, mamy
  
Ponieważ <math>p \equiv 1 \!\! \pmod{8}</math>, to
+
::<math>2^n \alpha^n = (P + \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} \delta^j</math>
  
::<math>\left( {\small\frac{2}{p}} \right)_{\small{\!\! L}} = 1</math>
+
::<math>2^n \beta^n = (P - \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (- \delta)^j</math>
  
(zobacz J31 p.7). Oczywiście <math>p \equiv 1 \!\! \pmod{4}</math>, zatem dla dowolnej liczby pierwszej nieparzystej <math>q_i \leqslant m</math> z&nbsp;twierdzenia J31 p.9 otrzymujemy
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
Obliczając różnicę wyjściowych wzorów, mamy
::<math>\left( {\small\frac{q_i}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{p}{q_i}} \right)_{\small{\!\! L}} = \left( {\small\frac{a k + 1}{q_i}} \right)_{\small{\!\! L}} = \left( {\small\frac{1}{q_i}} \right)_{\small{\!\! L}} = 1</math>
 
</div>
 
  
Wynika stąd, że najmniejsza liczba niekwadratowa modulo <math>p</math> jest większa od <math>m</math>. Wiemy też, że (zobacz A9)
+
::<math>2^n (\alpha^n - \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j - (- \delta)^j) =</math>
  
::<math>a = 4 P (m) < 4 \cdot 4^m = 4^{m + 1}</math>
+
:::::<math>\quad \: = \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot 2 \delta^j</math>
  
Załóżmy teraz, że <math>p</math> jest najmniejszą liczbą pierwszą w&nbsp;ciągu arytmetycznym <math>u_k = a k + 1</math>, a&nbsp;liczba <math>m</math> została wybrana tak, że liczba <math>a = 4 P (m)</math> jest dostatecznie duża i&nbsp;możliwe jest skorzystanie z&nbsp;twierdzenia Linnika (zobacz C30). Dostajemy natychmiast oszacowanie
+
:::::<math>\quad \: = 2 \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot \delta \cdot D^{(j - 1) / 2}</math>
  
::<math>p = p_{\min} (a, 1) < a^L</math>
+
Rozpatrując powyższą równość modulo <math>Q</math> dostajemy (zobacz M43)
  
gdzie <math>L</math> jest stałą Linnika (możemy przyjąć <math>L = 5</math>). Łącząc powyższe oszacowania, łatwo otrzymujemy oszacowanie najmniejszej liczby niekwadratowej modulo <math>p</math>
+
::<math>2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\delta}} = 2^{n - 1} U_n \equiv \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot P^{j - 1}</math>
  
::<math>\mathbb{n}(p) \geqslant m + 1 > \log_4 a = {\small\frac{\log a}{\log 4}} = {\small\frac{\log a^L}{2 L \log 2}} > {\small\frac{\log p}{2 L \log 2}}</math>
+
:::::::::<math>\;\:\: \equiv P^{n - 1} \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j}</math>
  
Każdemu wyborowi innej liczby <math>m' > m</math> takiej, że <math>P(m') > P (m)</math> odpowiada inna liczba pierwsza <math>p'</math> taka, że <math>\mathbb{n}(p') > {\small\frac{\log p'}{2 L \log 2}}</math>, zatem liczb pierwszych <math>p</math> dla których najmniejsza liczba niekwadratowa modulo <math>p</math> jest większa od <math>{\small\frac{\log p}{2 L \log 2}}</math> jest nieskończenie wiele.<br/>
+
:::::::::<math>\;\:\: \equiv 2^{n - 1} P^{n - 1}</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
Czyli
  
 +
::<math>2^{n - 1} (U_n - P^{n - 1}) \equiv 0 \pmod{Q}</math>
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K25</span><br/>
+
Ponieważ <math>Q</math> dzieli <math>2^{n - 1} (U_n - P^{n - 1})</math>, to tym bardziej <math>d</math> dzieli <math>2^{n - 1} (U_n - P^{n - 1})</math>. Z założenia <math>\gcd (d, 2^{n - 1}) = 1</math>, zatem <math>d</math> dzieli <math>U_n - P^{n - 1}</math> (zobacz C74).
W twierdzeniu K23 pokazaliśmy, że dla każdej liczby pierwszej <math>\mathbb{n}</math> istnieją takie liczby pierwsze <math>p</math>, że <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math>. Zatem zbiór <math>S_\mathbb{n}</math> liczb pierwszych takich, że dla każdej liczby <math>p \in S_\mathbb{n}</math> liczba <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>p</math> jest zbiorem niepustym. Wynika stąd, że zbiór <math>S_\mathbb{n}</math> ma element najmniejszy i&nbsp;możemy te najmniejsze liczby pierwsze łatwo znaleźć – wystarczy w&nbsp;PARI/GP napisać proste polecenie
 
 
 
<span style="font-size: 90%; color:black;">'''forprime'''(n = 2, 50, '''forprime'''(p = 2, 10^10, '''if'''( A(p) == n, '''print'''(n, "  ", p); '''break'''() )))</span>
 
 
 
W tabeli przedstawiamy uzyskane rezultaty (zobacz też [https://oeis.org/A000229 A000229]).
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
 
|-
 
! <math>\boldsymbol{\mathbb{n}}</math>  
 
| <math>2</math> || <math>3</math> || <math>5</math> || <math>7</math> || <math>11</math> || <math>13</math> || <math>17</math> || <math>19</math> || <math>23</math> || <math>29</math> || <math>31</math> || <math>37</math> || <math>41</math> || <math>43</math> || <math>47</math>
 
|-
 
! <math>\boldsymbol{p}</math>  
 
| <math>3</math> || <math>7</math> || <math>23</math> || <math>71</math> || <math>311</math> || <math>479</math> || <math>1559</math> || <math>5711</math> || <math>10559</math> || <math>18191</math> || <math>31391</math> || <math>422231</math> || <math>701399</math> || <math>366791</math> || <math>3818929</math>
 
|}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K26</span><br/>
 
Z nierówności Pólyi-Winogradowa (zobacz K8) wynika natychmiast oszacowanie najmniejszej liczby niekwadratowej modulo <math>p</math>. Ponieważ najdłuższy ciąg kolejnych liczb kwadratowych modulo <math>p</math> nie może być dłuższy od <math>\left\lfloor \sqrt{p} \log p \right\rfloor</math>, to
 
 
 
::<math>\mathbb{n} (p) \leqslant \left\lfloor \sqrt{p} \log p \right\rfloor + 1 < \sqrt{p} \log p + 1</math>
 
 
 
Pokażemy, że powyższe oszacowanie można łatwo wzmocnić.
 
  
 +
W przypadku szczególnym, gdy <math>d = p</math>, gdzie <math>p</math> jest nieparzystą liczbą pierwszą i <math>p \nmid P</math>, z&nbsp;twierdzenia Fermata otrzymujemy natychmiast
  
 
+
::<math>U_p \equiv P^{p - 1} \equiv 1 \pmod{p}</math>
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K27</span><br/>
 
Niech <math>p</math> będzie liczbą pierwszą nieparzystą, a <math>\mathbb{n}</math> będzie najmniejszą liczbą niekwadratową modulo <math>p</math>. Prawdziwe jest oszacowanie
 
 
 
::<math>\mathbb{n} (p) < \sqrt{p} + {\small\frac{1}{2}}</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Ponieważ <math>\mathbb{n} \nmid p</math>, to z&nbsp;oszacowania <math>x - 1 < \lfloor x \rfloor \leqslant x</math> wynika, że
 
 
 
::<math>{\small\frac{p}{\mathbb{n}}} - 1 < \left\lfloor {\small\frac{p}{\mathbb{n}}} \right\rfloor < {\small\frac{p}{\mathbb{n}}}</math>
 
 
 
::<math>p < \mathbb{n} \left\lfloor {\small\frac{p}{\mathbb{n}}} \right\rfloor + \mathbb{n} < p + \mathbb{n}</math>
 
 
 
Niech <math>u = \left\lfloor {\small\frac{p}{\mathbb{n}}} \right\rfloor + 1</math>, mamy
 
 
 
::<math>0 < \mathbb{n} u - p < \mathbb{n}</math>
 
 
 
Liczba <math>\mathbb{n} u - p</math> musi być liczbą kwadratową modulo <math>p</math>, zatem
 
 
 
::<math>1 = \left( {\small\frac{\mathbb{n} u - p}{p}} \right)_{\small{\!\! L}} = \left( {\small\frac{\mathbb{n}}{p}} \right)_{\small{\!\! L}} \cdot \left( {\small\frac{u}{p}} \right)_{\small{\!\! L}} = - \left( {\small\frac{u}{p}} \right)_{\small{\!\! L}}</math>
 
 
 
Ale z&nbsp;założenia <math>\mathbb{n}</math> jest najmniejszą liczbą taką, że <math>\left( {\small\frac{\mathbb{n}}{p}} \right)_{\small{\!\! L}} = - 1</math>. Wynika stąd, że musi być <math>\mathbb{n} \leqslant u</math> i&nbsp;łatwo znajdujemy, że
 
 
 
::<math>\mathbb{n} \leqslant \left\lfloor {\small\frac{p}{\mathbb{n}}} \right\rfloor + 1 < {\small\frac{p}{\mathbb{n}}} + 1</math>
 
 
 
::<math>\mathbb{n}^2 < p + \mathbb{n}</math>
 
 
 
Ponieważ wypisane liczby są liczbami całkowitymi, to ostatnią nierówność możemy zapisać w&nbsp;postaci
 
 
 
::<math>\mathbb{n}^2 \leqslant p + \mathbb{n} - 1</math>
 
 
 
Skąd otrzymujemy
 
 
 
::<math>\left( \mathbb{n} - {\small\frac{1}{2}} \right)^2 \leqslant p - {\small\frac{3}{4}}</math>
 
 
 
::<math>\mathbb{n} \leqslant {\small\frac{1}{2}} + \sqrt{p - {\small\frac{3}{4}}} < {\small\frac{1}{2}} + \sqrt{p}</math>
 
  
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
Linia 1272: Linia 796:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K28*</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M19</span><br/>
Niech <math>p</math> będzie liczbą pierwszą nieparzystą, a <math>\mathbb{n}</math> będzie najmniejszą liczbą niekwadratową modulo <math>p</math>. Dla <math>p \geqslant 5</math> prawdziwe jest oszacowanie<ref name="Norton1"/><ref name="Trevino1"/><ref name="Trevino2"/>
+
Niech <math>D = P^2 - 4 Q</math>, a <math>(D \mid p)</math> oznacza symbol Legendre'a, gdzie <math>p</math> jest liczbą pierwszą nieparzystą i <math>p \nmid Q</math>. Mamy
 
 
::<math>\mathbb{n} (p) \leqslant 1.1 \cdot p^{1 / 4} \log p</math>
 
  
 
+
::{| border="0"
 
+
|-style=height:2em
<span style="font-size: 110%; font-weight: bold;">Uwaga K29</span><br/>
+
| &#9679;&nbsp;&nbsp;&nbsp; <math>U_p \equiv (D \mid p) \pmod{p}</math>
Liczby <math>\mathbb{n} = \mathbb{n} (p)</math> są zaskakująco małe. Średnia wartość <math>\mathbb{n} = \mathbb{n} (p)</math>, gdzie <math>p</math> są nieparzystymi liczbami pierwszymi, jest równa<ref name="Erdos1"/>
+
|-style=height:2em
 
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>(D \mid p) = - 1 , \;</math> to <math>\; p \mid U_{p + 1}</math>
::<math>\lim_{x \to \infty} {\small\frac{1}{\pi (x)}} \sum_{p \leqslant x} \mathbb{n} (p) = \sum_{k = 1}^{\infty} {\small\frac{p_k}{2^k}} = 3.674643966 \ldots</math>
+
|-style=height:2em
 
+
| &#9679;&nbsp;&nbsp;&nbsp; jeżeli <math>(D \mid p) = 1 , \;</math> to <math>\; p \mid U_{p - 1}</math>
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K30</span><br/>
 
Możemy też badać najmniejsze '''nieparzyste''' liczby niekwadratowe modulo <math>p</math>. Pokażemy, że są one również liczbami pierwszymi. W tabeli przedstawiliśmy najmniejsze '''nieparzyste''' liczby niekwadratowe modulo <math>p</math>.
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
 
|-
 
! <math>\boldsymbol{m}</math>  
 
| <math>5</math> || <math>7</math> || <math>9</math> || <math>11</math> || <math>13</math> || <math>15</math> || <math>17</math> || <math>19</math> || <math>21</math> || <math>23</math> || <math>25</math> || <math>27</math> || <math>29</math> || <math>31</math> || <math>33</math> || <math>35</math> || <math>37</math> || <math>39</math> || <math>41</math> || <math>43</math> || <math>45</math> || <math>47</math> || <math>49</math> || <math>51</math>
 
|-
 
! <math>\boldsymbol{\mathbb{n}_1( p )}</math>
 
| <math>3</math> || <math>3</math> || <math>-</math> || <math>7</math> || <math>5</math> || <math>-</math> || <math>3</math> || <math>3</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math> || <math>3</math> || <math>3</math> || <math>-</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>3</math> || <math>3</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math>
 
 
|}
 
|}
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K31</span><br/>
 
Dla każdej liczby pierwszej <math>p \geqslant 5</math> najmniejsza '''nieparzysta''' liczba niekwadratowa modulo <math>p</math> jest liczbą pierwszą mniejszą od <math>p</math>.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Niech <math>S \subset \{ 1, 2, \ldots, p - 1 \}</math> będzie zbiorem wszystkich '''nieparzystych''' liczb niekwadratowych modulo <math>p</math>. Z&nbsp;twierdzenia J27 wiemy, że jeżeli <math>p</math> jest liczbą pierwszą nieparzystą, to w&nbsp;zbiorze <math>\{ 1, 2, \ldots, p - 1 \}</math> jest dokładnie <math>{\small\frac{p - 1}{2}}</math> liczb kwadratowych modulo <math>p</math> i&nbsp;tyle samo liczb niekwadratowych modulo <math>p</math>. W&nbsp;zbiorze <math>\{ 1, 2, \ldots, p - 1 \}</math> mamy też dokładnie <math>{\small\frac{p - 1}{2}}</math> liczb parzystych i&nbsp;tyle samo liczb nieparzystych.
+
'''Punkt 1.'''
  
Wszystkie liczby parzyste nie mogą być liczbami niekwadratowymi modulo <math>p</math>, bo <math>4 = 2^2 < 5 \leqslant p</math> jest parzystą liczbą kwadratową modulo <math>p</math>, czyli wśród liczb nieparzystych musi istnieć przynajmniej jedna liczba niekwadratowa modulo <math>p</math>. Wynika stąd, że zbiór <math>S</math> nie jest zbiorem pustym, zatem ma element najmniejszy. Pokażemy, że najmniejszy element zbioru <math>S</math> jest liczbą pierwszą.
+
Zauważmy, że przypadek gdy <math>p \mid Q</math>, omówiliśmy w&nbsp;twierdzeniu poprzednim. Z&nbsp;założenia <math>p</math> jest liczbą pierwszą nieparzystą. Z&nbsp;twierdzenia M7, w&nbsp;przypadku nieparzystego <math>n = p</math>, otrzymujemy
  
Niech <math>3 \leqslant \mathbb{n}_\boldsymbol{1} \leqslant p - 2</math> będzie najmniejszą '''nieparzystą''' liczbą niekwadratową modulo <math>p</math>. Wynika stąd, że każda liczba <math>a < \mathbb{n}_\boldsymbol{1}</math> musi być liczbą parzystą lub liczbą kwadratową modulo <math>p</math>. Przypuśćmy, że <math>\mathbb{n}_\boldsymbol{1}</math> jest liczbą złożoną, czyli <math>\mathbb{n}_\boldsymbol{1} = a b</math>, gdzie <math>1 < a, b < \mathbb{n}_\boldsymbol{1}</math>. Zauważmy, że żadna z&nbsp;liczb <math>a, b</math> nie może być liczbą parzystą, bo wtedy liczba <math>\mathbb{n}_\boldsymbol{1}</math> również byłaby liczbą parzystą wbrew określeniu liczby <math>\mathbb{n}_\boldsymbol{1}</math>. Zatem obie liczby <math>a, b</math> muszą być nieparzystymi liczbami kwadratowymi, co jest niemożliwe, bo
+
::<math>2^{p - 1} U_p = p P^{p - 1} + \binom{p}{3} P^{p - 3} D + \binom{p}{5} P^{p - 5} D^2 + \ldots + \binom{p}{p-2} P^2 D^{(p - 3) / 2} + D^{(p - 1) / 2}</math>
  
::<math>- 1 = \left( {\small\frac{\mathbb{n}_\boldsymbol{1}}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{a b}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{a}{p}} \right)_{\small{\!\! J}} \cdot \left( {\small\frac{b}{p}} \right)_{\small{\!\! J}}</math>
+
Ponieważ dla każdego <math>k \in [1, p - 1]</math> (zobacz M43)
  
i jeden z&nbsp;czynników po prawej stronie musi być ujemny. Co oznacza, że jedna z&nbsp;liczb <math>a, b</math> jest nieparzystą liczbą niekwadratową modulo <math>p</math> mniejszą od <math>\mathbb{n}_\boldsymbol{1}</math> wbrew określeniu liczby <math>\mathbb{n}_\boldsymbol{1}</math>. Uzyskana sprzeczność pokazuje, że liczba <math>\mathbb{n}_\boldsymbol{1}</math> jest liczbą pierwszą. Co kończy dowód.<br/>
+
::<math>\binom{p}{k} \equiv 0 \pmod{p}</math>
&#9633;
 
{{\Spoiler}}
 
  
 +
to modulo <math>p</math> dostajemy (zobacz J30)
  
 +
::<math>2^{p - 1} U_p \equiv U_p \equiv D^{(p - 1) / 2} \equiv (D \mid p) \pmod{p}</math>
  
 +
'''Punkt 2.'''
  
 +
Zauważmy, że warunek <math>(D \mid p) = - 1</math> nie może być spełniony, gdy <math>p \mid Q</math>. Istotnie, gdy <math>p \mid Q</math>, to <math>D = P^2 - 4 Q \equiv P^2 \pmod{p}</math>, czyli
  
{| style="border-spacing: 5px; border: 2px solid black; background: transparent;"
+
::<math>(D \mid p) = (P^2 \mid p) = (P \mid p)^2 = 0 , \;</math> gdy <math>p \mid P</math>
| &nbsp;'''B.''' Najmniejsze dodatnie liczby niekwadratowe modulo <math>m</math>
 
|}
 
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K32</span><br/>
+
lub
Najmniejsze liczby niekwadratowe modulo <math>m</math> są naturalnym uogólnieniem najmniejszych liczb niekwadratowych modulo <math>p .</math> W&nbsp;jednym i&nbsp;drugim przypadku liczba <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową w&nbsp;zbiorze wszystkich liczb niekwadratowych dodatnich nie większych od <math>p</math> lub <math>m .</math> Dlatego będziemy je oznaczali również jako <math>\mathbb{n}(m) .</math>
 
  
 +
::<math>(D \mid p) = (P^2 \mid p) = (P \mid p)^2 = 1 , \;</math> gdy <math>p \nmid P</math>
  
 +
i nie może być <math>(D \mid p) = - 1</math>.
  
<span style="font-size: 110%; font-weight: bold;">Definicja K33</span><br/>
+
Dla parzystego <math>n = p + 1</math> otrzymujemy z&nbsp;twierdzenia M7
Niech <math>m \in \mathbb{Z} \,</math> i <math>\, m \geqslant 3 .</math> Powiemy, że <math>\mathbb{n} (m)</math> jest najmniejszą liczbą niekwadratową modulo <math>m</math>, gdy <math>\mathbb{n}</math> jest najmniejszą liczbą dodatnią względnie pierwszą z <math>m</math> taką, że kongruencja
 
  
::<math>x^2 \equiv \mathbb{n} \pmod{m}</math>
+
::<math>2^p U_{p + 1} = (p + 1) P^p + \binom{p + 1}{3} P^{p - 2} D + \binom{p + 1}{5} P^{p - 4} D^2 + \ldots + \binom{p + 1}{p - 2} P^3 D^{(p - 3) / 2} + (p + 1) P D^{(p - 1) / 2}</math>
  
nie ma rozwiązania.
+
Ponieważ dla <math>k \in [2, p - 1]</math> (zobacz M44)
  
 +
::<math>\binom{p + 1}{k} \equiv 0 \pmod{p}</math>
  
 +
to modulo <math>p</math> dostajemy
  
<span style="font-size: 110%; font-weight: bold;">Przykład K34</span><br/>
+
::<math>2 U_{p + 1} \equiv P + P D^{(p - 1) / 2} \pmod{p}</math>
W tabeli przedstawiliśmy najmniejsze liczby niekwadratowe modulo <math>p</math> i&nbsp;najmniejsze liczby niekwadratowe modulo <math>m .</math>
 
  
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
 
! <math>\boldsymbol{m}</math>
 
| <math>3</math> || <math>5</math> || <math>7</math> || <math>9</math> || <math>11</math> || <math>13</math> || <math>15</math> || <math>17</math> || <math>19</math> || <math>21</math> || <math>23</math> || <math>25</math> || <math>27</math> || <math>29</math> || <math>31</math> || <math>33</math> || <math>35</math> || <math>37</math> || <math>39</math> || <math>41</math> || <math>43</math> || <math>45</math> || <math>47</math> || <math>49</math> || <math>51</math>
 
|-
 
! <math>\boldsymbol{\mathbb{n}( p )}</math>
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>2</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math>
 
|-
 
! <math>\boldsymbol{\mathbb{n}( m )}</math>
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>3</math> || <math>2</math>
 
|}
 
  
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
+
Z założenia <math>D</math> jest liczbą niekwadratową modulo <math>p</math>, zatem <math>D^{(p - 1) / 2} \equiv - 1 \pmod{p}</math> (zobacz J28). Skąd wynika natychmiast, że
|-
 
! <math>\boldsymbol{m}</math>  
 
| <math>4</math> || <math>6</math> || <math>8</math> || <math>10</math> || <math>12</math> || <math>14</math> || <math>16</math> || <math>18</math> || <math>20</math> || <math>22</math> || <math>24</math> || <math>26</math> || <math>28</math> || <math>30</math> || <math>32</math> || <math>34</math> || <math>36</math> || <math>38</math> || <math>40</math> || <math>42</math> || <math>44</math> || <math>46</math> || <math>48</math> || <math>50</math> || <math>52</math>
 
|-
 
! <math>\boldsymbol{\mathbb{n}( m )}</math>  
 
| <math>3</math> || <math>5</math> || <math>3</math> || <math>3</math> || <math>5</math> || <math>3</math> || <math>3</math> || <math>5</math> || <math>3</math> || <math>7</math> || <math>5</math> || <math>5</math> || <math>3</math> || <math>7</math> || <math>3</math> || <math>3</math> || <math>5</math> || <math>3</math> || <math>3</math> || <math>5</math> || <math>3</math> || <math>5</math> || <math>5</math> || <math>3</math> || <math>3</math>
 
|}
 
  
 +
::<math>2 U_{p + 1} \equiv 0 \pmod{p}</math>
  
 +
Czyli <math>p \mid U_{p + 1}</math>.
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K35</span><br/>
+
'''Punkt 3.'''
Do wyszukiwania liczb <math>\mathbb{n} (m)</math> Czytelnik może wykorzystać prostą funkcję napisaną w&nbsp;PARI/GP
 
  
<span style="font-size: 90%; color:black;">B(m) =
+
Dla parzystego <math>n = p - 1</math> otrzymujemy z&nbsp;twierdzenia M7
{
 
'''local'''(p, res);
 
p = 1;
 
'''while'''( p < m,
 
        p = '''nextprime'''(p + 1);
 
        '''if'''( m%p == 0, '''next'''() );
 
        res = -1;
 
        '''for'''( k = 2, '''floor'''(m/2), '''if'''( k^2%m == p, res = 1; '''break'''() ) );
 
        '''if'''( res == -1, '''return'''(p) );
 
      );
 
}</span>
 
 
 
Obliczenia można wielokrotnie przyspieszyć, modyfikując kod funkcji tak, aby uwzględniał pokazane niżej właściwości oraz parzystość liczby <math>m .</math> Tutaj przedstawiamy tylko przykład, który wykorzystuje część tych możliwości.
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 
<span style="font-size: 90%; color:black;">B(m) =
 
{
 
'''local'''(p, res, t);
 
t = m%8;
 
'''if'''( t == 3 || t == 5, '''return'''(2) );
 
t = m%12;
 
'''if'''( t == 4 || t == 8, '''return'''(3) );
 
t = m%24;
 
'''if'''( t == 9 || t == 15, '''return'''(2) );
 
'''if'''( t == 10 || t == 14, '''return'''(3) );
 
t = m%30;
 
'''if'''( t == 6 || t == 12 || t == 18 || t == 24, '''return'''(5) );
 
p = 1;
 
'''while'''( p < m,
 
        p = '''nextprime'''(p + 1);
 
        '''if'''( m%p == 0, '''next'''() );
 
        res = -1;
 
        '''for'''( k = 2, '''floor'''(m/2), '''if'''( k^2%m == p, res = 1; '''break'''() ) );
 
        '''if'''( res == -1, '''return'''(p) );
 
      );
 
}</span>
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K36</span><br/>
 
Niech <math>m \in \mathbb{Z} \,</math> i <math>\, m \geqslant 3 .</math> Jeżeli <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>m</math>, to <math>\mathbb{n}</math> jest liczbą pierwszą.
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Przypuśćmy, że <math>\mathbb{n} = a b</math> jest liczbą złożoną, gdzie <math>1 < a, b < \mathbb{n} .</math> Z&nbsp;założenia <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>m</math>, zatem liczby <math>a, b</math> są liczbami kwadratowymi modulo <math>m .</math> Z&nbsp;definicji liczb kwadratowych muszą istnieć takie liczby <math>r, s</math>, że
 
 
 
::<math>r^2 \equiv a \pmod{m}</math>
 
  
::<math>s^2 \equiv b \pmod{m}</math>
+
::<math>2^{p - 2} U_{p - 1} = (p - 1) P^{p - 2} + \binom{p - 1}{3} P^{p - 4} D + \binom{p - 1}{5} P^{p - 6} D^2 + \ldots + \binom{p - 1}{p - 4} P^3 D^{(p - 5) / 2} + (p - 1) P D^{(p - 3) / 2}</math>
  
Skąd wynika, że
+
Ponieważ dla <math>k \in [0, p - 1]</math> (zobacz M45)
  
::<math>\mathbb{n} = a b \equiv (r s)^2 \pmod{m}</math>
+
::<math>\binom{p - 1}{k} \equiv (- 1)^k \pmod{p}</math>
  
Wbrew założeniu, że <math>\mathbb{n}</math> jest liczbą niekwadratową modulo <math>m .</math><br/>
+
to modulo <math>p</math> mamy
&#9633;
 
{{\Spoiler}}
 
  
 +
::<math>2^{p - 2} U_{p - 1} \equiv - (P^{p - 2} + P^{p - 4} D + P^{p - 6} D^2 + \ldots + P D^{(p - 3) / 2}) \pmod{p}</math>
  
 +
::::<math>\quad \,\, \equiv - P (P^{p - 3} + P^{p - 5} D + P^{p - 7} D^2 + \ldots + D^{(p - 3) / 2}) \pmod{p}</math>
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K37</span><br/>
 
Niech <math>m \in \mathbb{Z}_+ \,</math> i <math>\, \mathbb{n} (m)</math> będzie najmniejszą liczbą niekwadratową modulo <math>m .</math> Pokazać, że jeżeli <math>m = 8 k \pm 3</math>, to <math>\mathbb{n} (m) = 2 .</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
Z założenia <math>D</math> jest liczbą kwadratową modulo <math>p</math> (zobacz J26), zatem istnieje taka liczba <math>R</math>, że
Z twierdzenia J38 wiemy, że <math>\left( {\small\frac{2}{m}} \right)_{\small{\!\! J}} = - 1</math>, gdy <math>m = 8 k \pm 3 .</math> Wynika stąd, że <math>2</math> jest liczbą niekwadratową modulo <math>m</math>, a&nbsp;jeśli tak, to musi być najmniejszą liczbą niekwadratową modulo <math>m .</math> Co należało pokazać.<br/>
 
&#9633;
 
{{\Spoiler}}
 
  
 +
::<math>D \equiv R^2 \pmod{p}</math>
  
 +
Ponieważ
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K38</span><br/>
+
:* <math>(D \mid p) = 1</math>, to <math>p \nmid D</math>, zatem <math>p \nmid R</math>
Niech <math>m \in \mathbb{Z}_+ \,</math> i <math>\, \mathbb{n} (m)</math> będzie najmniejszą liczbą niekwadratową modulo <math>m .</math> Pokazać, że jeżeli spełniony jest jeden z&nbsp;warunków
+
:* z&nbsp;założenia <math>p \nmid Q</math>, to <math>P^2 - R^2 \equiv P^2 - D \equiv 4 Q \not\equiv 0 \pmod{p}</math>
  
:*&nbsp;&nbsp;<math>4 \mid m \;</math> i <math>\; \gcd (3, m) = 1</math>
 
:*&nbsp;&nbsp;<math>m = 12 k \pm 4</math>
 
  
to <math>\mathbb{n} (m) = 3 .</math>
+
Czyli
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
::<math>2^{p - 2} U_{p - 1} \equiv - P (P^{p - 3} + P^{p - 5} R^2 + P^{p - 7} R^4 + \ldots + R^{p - 3}) \pmod{p}</math>
Zauważmy, że <math>2</math> nie może być najmniejszą liczbą niekwadratową modulo <math>m</math>, bo <math>2 \mid m .</math> Rozważmy kongruencję
 
  
::<math>x^2 \equiv 3 \pmod{m}</math>
 
  
Z założenia <math>4 \mid m</math>, co nie wyklucza możliwości, że również <math>8 \mid m .</math> Ponieważ <math>4 \nmid (3 - 1)</math> i <math>8 \nmid (3 - 1)</math>, to z&nbsp;twierdzenia J52 wynika, że kongruencja <math>x^2 \equiv 3 \!\! \pmod{m}</math> nie ma rozwiązania. Jeśli tylko <math>3 \nmid m</math>, to <math>\mathbb{n} (m) = 3 .</math> W&nbsp;pierwszym punkcie jest to założone wprost, w&nbsp;drugim łatwo widzimy, że <math>3 \nmid (12 k \pm 4) .</math>
+
Uwzględniając, że <math>P^2 - R^2 \not\equiv 0 \pmod{p}</math>, możemy napisać
  
Można też zauważyć, że żądanie, aby <math>\gcd (3, m) = 1</math>, prowadzi do dwóch układów kongruencji
+
::<math>2^{p - 2} (P^2 - R^2) U_{p - 1} \equiv - P (P^2 - R^2) (P^{p - 3} + P^{p - 5} R^2 + P^{p - 7} R^4 + \ldots + R^{p - 3}) \pmod{p}</math>
  
::<math>\begin{align}
+
::::::::<math>\equiv - P (P^{p - 1} - R^{p - 1}) \pmod{p}</math>
m &\equiv 0 \pmod{4} \\
 
m &\equiv 1 \pmod{3}
 
\end{align}</math>
 
  
oraz
+
::::::::<math>\equiv 0 \pmod{p}</math>
  
::<math>\begin{align}
+
Zauważmy, że wynik nie zależy od tego, czy <math>p \mid P</math>, czy <math>p \nmid P</math>. Skąd wynika
m &\equiv 0 \pmod{4} \\
 
m &\equiv 2 \pmod{3}
 
\end{align}</math>
 
  
którym, na mocy chińskiego twierdzenia o&nbsp;resztach, odpowiadają dwie kongruencje równoważne
+
::<math>U_{p - 1} \equiv 0 \pmod{p}</math>
 
 
::<math>m \equiv \pm 4 \pmod{12}</math>
 
  
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
Linia 1476: Linia 904:
  
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K39</span><br/>
+
Aby zapisać punkty 2. i 3. twierdzenia M19 (i tylko te punkty) w&nbsp;zwartej formie, musimy założyć, że <math>\gcd (p, D) = 1</math>. Otrzymujemy<br/>
Niech <math>m = 24 k \pm 10 .</math> Pokazać, że <math>\mathbb{n} (m) = 3 .</math>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M20</span><br/>
 +
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą i <math>\gcd (p, Q D) = 1</math>, to
 +
 
 +
::<math>U_{p - (D \mid p)} \equiv 0 \pmod{p}</math>
 +
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 
Zapiszmy <math>m</math> w&nbsp;postaci <math>m = 2 m'</math>, gdzie <math>m' = 12 k \pm 5 .</math> Gdyby kongruencja
 
  
::<math>x^2 \equiv 3 \pmod{2 m'}</math>
 
  
miała rozwiązanie, to również kongruencja
 
  
::<math>x^2 \equiv 3 \pmod{m'}</math>
+
== Liczby pseudopierwsze Lucasa ==
  
miałaby rozwiązanie, ale jest to niemożliwe, bo <math>\left( {\small\frac{3}{m'}} \right)_{\small{\!\! J}} = - 1</math> (zobacz J43), czyli <math>3</math> jest liczbą niekwadratową modulo <math>m' .</math> Ponieważ <math>2 \mid m</math>, to <math>2</math> nie może być najmniejszą liczbą niekwadratową modulo <math>m .</math> Wynika stąd, że <math>\mathbb{n} (m) = 3 .</math><br/>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M21</span><br/>
&#9633;
+
Z twierdzenia M20 wiemy, że liczby pierwsze nieparzyste <math>p</math> takie, że <math>p \nmid Q D</math> są dzielnikami wyrazów ciągu Lucasa <math>U_{p - (D \mid p)}</math>, gdzie <math>(D \mid p)</math> oznacza symbol Legendre'a. Jeśli zastąpimy symbol Legendre'a symbolem Jacobiego, to będziemy mogli badać prawdziwość tego twierdzenia dla liczb złożonych i&nbsp;łatwo przekonamy się, że dla pewnych liczb złożonych <math>m</math> kongruencja
{{\Spoiler}}
 
  
 +
::<math>U_{m - (D \mid m)} \equiv 0 \pmod{m}</math>
  
 +
również jest prawdziwa. Prowadzi to definicji liczb pseudopierwszych Lucasa.
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K40</span><br/>
 
Niech <math>m \in \mathbb{Z}_+ \;</math> i <math>\; S_2 = \{ 3, 5, 11, 13, 19, 29, 37, 43, \ldots \}</math> będzie zbiorem liczb pierwszych <math>p</math> takich, że <math>\left( {\small\frac{2}{p}} \right)_{\small{\!\! J}} = - 1 .</math> Jeżeli <math>m</math> jest liczbą nieparzystą podzielną przez <math>p \in S_2</math>, to <math>\mathbb{n} (m) = 2 .</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Z założenia <math>p \mid m \;</math> i <math>\; \left( {\small\frac{2}{p}} \right)_{\small{\!\! J}} = - 1 .</math> Zatem kongruencja
 
  
::<math>x^2 \equiv 2 \pmod{m}</math>
+
<span style="font-size: 110%; font-weight: bold;">Definicja M22</span><br/>
 +
Powiemy, że liczba złożona nieparzysta <math>m</math> jest liczbą pseudopierwszą Lucasa dla parametrów <math>P</math> i <math>Q</math> (symbolicznie: LPSP( <math>P, Q</math> )), jeżeli <math>\gcd (m, Q D) = 1</math> i
  
nie ma rozwiązania (zobacz J52). Ponieważ <math>2 \nmid m</math>, to <math>\mathbb{n} (m) = 2 .</math>
+
::<math>U_{m - (D \mid m)} \equiv 0 \pmod{m}</math>
  
Uwaga: zbiór <math>S_2</math> tworzą liczby pierwsze postaci <math>8 k \pm 3</math> (zobacz J38).<br/>
+
gdzie <math>(D \mid m)</math> oznacza symbol Jacobiego.
&#9633;
 
{{\Spoiler}}
 
  
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K41</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M23</span><br/>
Niech <math>m \in \mathbb{Z}_+ \;</math> i <math>\; S_3 = \{ 5, 7, 17, 19, 29, 31, 41, 43, \ldots \}</math> będzie zbiorem liczb pierwszych <math>p</math> takich, że <math>\left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = - 1 .</math> Jeżeli <math>m</math> jest liczbą parzystą niepodzielną przez <math>3</math> i&nbsp;podzielną przez <math>p \in S_3</math>, to <math>\mathbb{n} (m) = 3 .</math>
+
Jeżeli liczba złożona nieparzysta <math>m</math> jest liczbą pseudopierwszą Lucasa dla parametrów <math>P = a + 1</math> i <math>Q = a</math>, gdzie <math>a \geqslant 2</math>, to jest liczbą pseudopierwszą Fermata przy podstawie <math>a</math>.
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Z założenia <math>p \mid m \;</math> i <math>\; \left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = - 1 .</math> Zatem kongruencja
+
Połóżmy we wzorze definiującym ciąg Lucasa
  
::<math>x^2 \equiv 3 \pmod{m}</math>
+
::<math>U_m = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}}</math>
  
nie ma rozwiązania (zobacz J52). Ponieważ <math>2 \mid m</math> i <math>3 \nmid m</math>, to <math>\mathbb{n} (m) = 3 .</math>
+
<math>\alpha = a</math> i <math>\beta = 1</math>. Odpowiada to parametrom <math>P = \alpha + \beta = a + 1</math>, <math>Q = \alpha \beta = a</math>, <math>D = (\alpha - \beta)^2 = (a - 1)^2</math>.
  
Uwaga: zbiór <math>S_3</math> tworzą liczby pierwsze postaci <math>12 k \pm 5</math> (zobacz J43).<br/>
+
Ponieważ musi być <math>\gcd (m, Q D) = 1</math>, to mamy <math>\gcd (m, (a - 1) a) = 1</math> i&nbsp;wynika stąd, że <math>(D \mid m) = 1</math>. Z&nbsp;założenia <math>m</math> jest liczbą pseudopierwszą Lucasa dla parametrów <math>P = a + 1</math> i <math>Q = a</math>, zatem
&#9633;
 
{{\Spoiler}}
 
  
 +
::<math>U_{m - 1} (a + 1, a) \equiv 0 \pmod{m}</math>
  
 +
Czyli
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K42</span><br/>
+
::<math>{\small\frac{a^{m - 1} - 1}{a - 1}} \equiv 0 \pmod{m}</math>
Jeżeli <math>m</math> jest liczbą dodatnią podzielną przez <math>6</math> i&nbsp;niepodzielną przez <math>5</math>, to <math>\mathbb{n} (m) = 5 .</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
Jeżeli <math>m \biggr\rvert {\small\frac{a^{m - 1} - 1}{a - 1}}</math>, to tym bardziej <math>m \big\rvert (a^{m - 1} - 1)</math> i&nbsp;możemy napisać
Z założenia <math>3 \mid m \;</math> i <math>\; \left( {\small\frac{5}{3}} \right)_{\small{\!\! J}} = \left( {\small\frac{2}{3}} \right)_{\small{\!\! J}} = - 1 .</math> Zatem kongruencja
 
  
::<math>x^2 \equiv 5 \pmod{m}</math>
+
::<math>a^{m - 1} - 1 \equiv 0 \pmod{m}</math>
  
nie ma rozwiązania (zobacz J52). Ponieważ <math>2 \mid m</math>, <math>3 \mid m</math> i <math>5 \nmid m</math>, to <math>\mathbb{n} (m) = 5 .</math><br/>
+
Zatem <math>m</math> jest liczbą pseudopierwszą Fermata przy podstawie <math>a</math>. Co należało pokazać.<br/>
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 1540: Linia 962:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K43</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M24</span><br/>
Niech <math>m \in \mathbb{Z}_+</math> i <math>p \geqslant 5</math> będzie liczbą pierwszą. Jeżeli iloczyn wszystkich liczb pierwszych mniejszych od <math>p</math> dzieli <math>m</math> i <math>p \nmid m</math>, to <math>\mathbb{n} (m) = p</math>.
+
Wykorzystując funkcje <code>jacobi(a, n)</code> i <code>modLucas(n, P, Q, m)</code> (zobacz J44, M15) możemy napisać prosty program, który sprawdza, czy dla liczby nieparzystej <math>m</math> prawdziwe jest twierdzenie M20.
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
<span style="font-size: 90%; color:black;">isPrimeOr<span style="background-color: #fee481;">LPSP</span>(m, P, Q) =
Z twierdzenia K75 wiemy, że istnieje liczba pierwsza nieparzysta <math>q < p</math> taka, że <math>\left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = - 1 .</math> Z&nbsp;założenia <math>q \mid m</math>, zatem kongruencja
+
{
 
+
'''local'''(D, js);
::<math>x^2 \equiv p \pmod{m}</math>
+
D = P^2 - 4*Q;
 
+
'''if'''( gcd(m, 2*Q*D) > 1, '''return'''(0) );
nie ma rozwiązania (zobacz J52). Ponieważ wszystkie liczby pierwsze mniejsze od <math>p</math> dzielą <math>m</math>, to <math>\mathbb{n} (m) = p</math>. Co należało pokazać.<br/>
+
js = jacobi(D, m);
&#9633;
+
'''if'''( modLucas(m - js, P, Q, m)[1] == 0, '''return'''(1), '''return'''(0) );
{{\Spoiler}}
+
}
  
  
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K44</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Przykład M25</span><br/>
Pokazać, że podanym w&nbsp;pierwszej kolumnie postaciom liczby <math>m</math> odpowiadają wymienione w&nbsp;drugiej kolumnie wartości <math>\mathbb{n} (m) .</math>
+
Poniższa tabela zawiera najmniejsze liczby pseudopierwsze Lucasa dla różnych parametrów <math>P</math> i <math>Q</math>
  
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: left; margin-right: auto;"
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 +
! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<math>\boldsymbol{P}</math><br/><math>\boldsymbol{Q}</math>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 +
! <math>\boldsymbol{1}</math> !! <math>\boldsymbol{2}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math> !! <math>\boldsymbol{10}</math>
 
|-
 
|-
! Postać liczby <math>\boldsymbol{m}</math> || <math>\boldsymbol{𝕟(m)}</math> || Uwagi
+
! <math>\boldsymbol{- 5}</math>
 +
| <math>253</math> || <math>121</math> || <math>57</math> || <math>217</math> || style="background-color: yellow" | <math>323</math> || <math>69</math> || <math>121</math> || <math>253</math> || <math>9</math> || style="background-color: yellow" | <math>143</math>
 
|-
 
|-
| <math>m=24k \pm 9</math> || style="text-align:center;" | <math>2</math> || rowspan="3" style="text-align:center;" | K40
+
! <math>\boldsymbol{- 4}</math>
 +
| <math>9</math> || style="background-color: yellow" | <math>323</math> || <math>91</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>15</math> || style="background-color: yellow" | <math>119</math> || <math>57</math> || <math>9</math> || <math>9</math> || <math>9</math>
 
|-
 
|-
| <math>m=120k \pm 25</math> || style="text-align:center;" | <math>2</math>
+
! <math>\boldsymbol{- 3}</math>
 +
| <math>217</math> || <math>91</math> || style="background-color: yellow" | <math>527</math> || <math>25</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>65</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>323</math>  
 
|-
 
|-
| <math>m=120k \pm 55</math> || style="text-align:center;" | <math>2</math>
+
! <math>\boldsymbol{- 2}</math>
 +
| <math>341</math> || style="background-color: yellow" | <math>209</math> || style="background-color: yellow" | <math>39</math> || <math>49</math> || <math>49</math> || style="background-color: yellow" | <math>15</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>35</math> || <math>9</math> || <math>85</math>  
 
|-
 
|-
| <math>m=120k \pm 50</math> || style="text-align:center;" | <math>3</math> || style="text-align:center;" | K41
+
! <math>\boldsymbol{- 1}</math>
 +
| style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>119</math> || <math>9</math> || <math>9</math> || style="background-color: yellow" | <math>143</math> || <math>25</math> || <math>33</math> || <math>9</math> || style="background-color: yellow" | <math>15</math>
 
|-
 
|-
| <math>m=30k \pm 6</math> || style="text-align:center;" | <math>5</math> || rowspan="2" style="text-align:center;" | K42, K43
+
! <math>\boldsymbol{1}</math>
 +
| <math>25</math> || style="background-color: red" | <math></math> || <math>21</math> || style="background-color: yellow" | <math>65</math> || style="background-color: yellow" | <math>115</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>209</math> || <math>9</math> || style="background-color: yellow" | <math>35</math>
 
|-
 
|-
| <math>m=30k \pm 12</math> || style="text-align:center;" | <math>5</math>
+
! <math>\boldsymbol{2}</math>
 +
| <math>1541</math> || <math>9</math> || <math>341</math> || style="background-color: yellow" | <math>35</math> || <math>21</math> || <math>85</math> || <math>9</math> || style="background-color: yellow" | <math>15</math> || <math>9</math> || style="background-color: yellow" | <math>35</math>  
 
|-
 
|-
| <math>m=210k \pm 30</math> || style="text-align:center;" | <math>7</math> || rowspan="3" style="text-align:center;" | K43
+
! <math>\boldsymbol{3}</math>
 +
| style="background-color: yellow" | <math>629</math> || style="background-color: yellow" | <math>559</math> || <math>25</math> || <math>91</math> || <math>49</math> || <math>49</math> || style="background-color: yellow" | <math>35</math> || <math>55</math> || <math>25</math> || style="background-color: yellow" | <math>35</math>
 
|-
 
|-
| <math>m=210k \pm 60</math> || style="text-align:center;" | <math>7</math>  
+
! <math>\boldsymbol{4}</math>
 +
| style="background-color: yellow" | <math>119</math> || <math>25</math> || style="background-color: yellow" | <math>209</math> || style="background-color: red" | <math></math> || <math>85</math> || <math>21</math> || style="background-color: yellow" | <math>119</math> || style="background-color: yellow" | <math>65</math> || <math>9</math> || style="background-color: yellow" | <math>115</math>  
 
|-
 
|-
| <math>m=210k \pm 90</math> || style="text-align:center;" | <math>7</math>  
+
! <math>\boldsymbol{5}</math>
 +
| <math>9</math> || style="background-color: yellow" | <math>143</math> || <math>49</math> || style="background-color: yellow" | <math>143</math> || style="background-color: yellow" | <math>323</math> || <math>217</math> || style="background-color: yellow" | <math>39</math> || <math>9</math> || <math>9</math> || <math>9</math>  
 
|}
 
|}
  
 
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 
+
  <span style="font-size: 90%; color:black;">FirstLPSP(Stop) =  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K45</span><br/>
+
\\ najmniejsze LPSP(P,Q) < Stop; dla 1<=P<=10 i -5<=Q<=5
Niech <math>m</math> będzie liczbą nieparzystą, a <math>\mathbb{n} (m)</math> będzie najmniejszą liczbą niekwadratową modulo <math>m .</math> Mamy
 
 
 
::<math>\begin{array}{lll}
 
  \mathbb{n} (2 m) >\mathbb{n} (m) &  & \text{gdy} \;\; \mathbb{n} (m) = 2 \\
 
  \mathbb{n} (2 m) =\mathbb{n} (m) &  & \text{gdy} \;\; \mathbb{n} (m) > 2
 
\end{array}</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
 
 
'''Punkt 1.'''
 
 
 
W przypadku, gdy <math>\mathbb{n} (m) = 2</math>, mamy <math>\mathbb{n} (2 m) > 2 = \mathbb{n} (m)</math>, bo <math>\mathbb{n} (2 m)</math> musi być liczbą względnie pierwszą z <math>2 m .</math>
 
 
 
'''Punkt 2.'''
 
 
 
Z definicji najmniejszej liczby niekwadratowej modulo <math>m</math> wiemy, że kongruencja
 
 
 
::<math>x^2 \equiv \mathbb{n} (m) \pmod{m}</math>
 
 
 
nie ma rozwiązania. Oznacza to, że istnieje liczba pierwsza nieparzysta <math>p</math> taka, że <math>p \mid m \;</math> i <math>\; \left( {\small\frac{\mathbb{n} (m)}{p}} \right)_{\small{\!\! J}} = - 1 .</math> Ponieważ <math>p \mid 2 m</math>, to wynika stąd natychmiast, że kongruencja
 
 
 
::<math>x^2 \equiv \mathbb{n} (m) \pmod{2 m}</math>
 
 
 
również nie ma rozwiązania (zobacz J52).
 
 
 
Zatem <math>\mathbb{n} (2 m) \leqslant \mathbb{n} (m) .</math> Niech <math>q</math> będzie liczbą pierwszą taką, że <math>2 < q <\mathbb{n} (m) .</math> Kongruencję
 
 
 
::<math>x^2 \equiv q \pmod{2 m} \qquad \qquad (1)</math>
 
 
 
możemy zapisać w&nbsp;postaci układu kongruencji równoważnych (zobacz J1)
 
 
 
::<math>\begin{align}
 
x^2 & \equiv q \pmod{m} \qquad \qquad \;\: (2) \\
 
  x^2 & \equiv q \pmod{2} \qquad \qquad \;\;\,\, (3) \\
 
\end{align}</math>
 
 
 
Z definicji <math>q</math> jest liczbą kwadratową modulo <math>m</math>, zatem kongruencja <math>(2)</math> ma rozwiązanie – oznaczmy to rozwiązanie przez <math>x_0 .</math> Łatwo zauważamy, że liczba
 
 
 
::<math>x'_0 =
 
  \begin{cases}
 
  \;\;\;\; x_0 & \text{gdy} \quad x_0 \equiv 1 \pmod{2} \\
 
  x_0 + m & \text{gdy} \quad x_0 \equiv 0 \pmod{2} \\
 
  \end{cases}</math>
 
 
 
jest rozwiązaniem układu kongruencji <math>(2)</math> i <math>(3)</math>, a&nbsp;tym samym kongruencja <math>(1)</math> ma rozwiązanie dla każdego <math>2 < q <\mathbb{n} (m) .</math> Wynika stąd, że <math>\mathbb{n} (2 m) =\mathbb{n} (m) .</math><br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K46</span><br/>
 
Niech <math>m</math> będzie liczbą nieparzystą, a <math>\mathbb{n} (m)</math> będzie najmniejszą liczbą niekwadratową modulo <math>m .</math> Mamy
 
 
 
::<math>\begin{array}{lllll}
 
  \mathbb{n} (4 m) \geqslant 5 & & \mathbb{n} (m) = 2        & & \text{gdy } \;\; 3 \mid m \\
 
  \mathbb{n} (4 m) = 3        & & \mathbb{n} (m) \geqslant 2 & & \text{gdy } \;\; 3 \nmid m \\
 
\end{array}</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
 
 
'''Punkt 1.'''
 
 
 
Z twierdzenia K40 wynika, że w&nbsp;przypadku, gdy <math>3 \mid m</math>, to <math>\mathbb{n} (m) = 2 .</math> Ponieważ <math>2 \mid 4 m</math> i <math>3 \mid 4 m</math>, to <math>\mathbb{n} (4 m) \geqslant 5 .</math>
 
 
 
'''Punkt 2.'''
 
 
 
Ponieważ <math>m</math> jest liczbą nieparzystą, to <math>8 \nmid 4 m</math>, ale <math>4 \mid 4 m \;</math> i <math>\; 4 \nmid (3 - 1)</math>, zatem z&nbsp;twierdzenia J52 wynika, że kongruencja
 
 
 
::<math>x^2 \equiv 3 \pmod{4 m}</math>
 
 
 
nie ma rozwiązania. Ponieważ <math>2 \mid 4 m \;</math> i <math>\; 3 \nmid 4 m</math>, to <math>\mathbb{n} (4 m) = 3 .</math><br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K47</span><br/>
 
Niech <math>p</math> będzie liczbą pierwszą nieparzystą. Jeżeli <math>a</math> jest liczbą niekwadratową modulo <math>p \,</math> i <math>\, p \mid m</math>, to <math>a</math> jest liczbą niekwadratową modulo <math>m .</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Wiemy, że liczba <math>a</math> jest liczbą kwadratową modulo <math>m</math> wtedy i&nbsp;tylko wtedy, gdy kongruencja
 
 
 
::<math>x^2 \equiv a \pmod{m}</math>
 
 
 
ma rozwiązanie. Przypuśćmy, że liczba <math>a</math> jest liczbą kwadratową modulo <math>m .</math> Zatem istnieje taka liczba <math>k \in \mathbb{Z}</math>, że
 
 
 
::<math>k^2 \equiv a \pmod{m}</math>
 
 
 
Ponieważ z&nbsp;założenia <math>p \mid m</math>, to prawdziwa jest też kongruencja
 
 
 
::<math>k^2 \equiv a \pmod{p}</math>
 
 
 
co przeczy założeniu, że liczba <math>a</math> jest liczbą niekwadratową modulo <math>p .</math><br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K48</span><br/>
 
Niech <math>m \geqslant 3</math> będzie liczbą nieparzystą. Jeżeli liczba <math>\mathbb{n} = \mathbb{n} (m)</math> jest najmniejszą liczbą niekwadratową modulo <math>m</math>, to istnieje taki dzielnik pierwszy <math>p</math> liczby <math>m</math>, że <math>\mathbb{n}</math> jest najmniejszą liczbą niekwadratową modulo <math>p .</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Przypuśćmy, że taki dzielnik pierwszy nie istnieje. Zatem mamy zbiór dzielników pierwszych liczby <math>m</math>: <math>\{ p_1, \ldots, p_s \}</math> i&nbsp;powiązany z&nbsp;dzielnikami pierwszymi <math>p_k</math> zbiór najmniejszych liczb niekwadratowych modulo <math>p_k</math>: <math>\{ \mathbb{n}_1, \ldots, \mathbb{n}_s \}</math>, z&nbsp;których każda jest liczbą niekwadratową modulo <math>m</math> (zobacz K47). Wynika stąd, że liczba <math>\mathbb{n} = \mathbb{n} (m)</math> musi być mniejsza od każdej z&nbsp;liczb <math>\mathbb{n}_k .</math>
 
 
 
Z definicji liczba <math>\mathbb{n} = \mathbb{n} (m)</math> jest liczbą niekwadratową modulo <math>m</math>, co oznacza, że kongruencja
 
 
 
::<math>x^2 \equiv \mathbb{n} \pmod{m}</math>
 
 
 
nie ma rozwiązania. Niech <math>m = p^{\alpha_1}_1 \cdot \ldots \cdot p^{\alpha_s}_s .</math> Zatem przynajmniej jedna z&nbsp;kongruencji
 
 
 
::<math>x^2 \equiv \mathbb{n} \pmod{p^{\alpha_k}_k}</math>
 
 
 
musi nie mieć rozwiązania (zobacz J11). Z&nbsp;twierdzenia J46 wiemy, że wtedy kongruencja
 
 
 
::<math>x^2 \equiv \mathbb{n} \pmod{p_k}</math>
 
 
 
również nie ma rozwiązania. Zatem <math>\mathbb{n}</math> jest liczbą niekwadratową modulo <math>p_k \,</math> i <math>\, \mathbb{n} < \mathbb{n}_k</math>, co przeczy definicji liczby <math>\mathbb{n}_k .</math><br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K49</span><br/>
 
Niech <math>m \geqslant 3</math> będzie liczbą nieparzystą. Jeżeli <math>m = p^{\alpha_1}_1 \cdot \ldots \cdot p^{\alpha_s}_s</math>, to
 
 
 
::<math>\mathbb{n}(m) = \min ( \mathbb{n} (p_1), \ldots, \mathbb{n} (p_s) )</math>
 
 
 
gdzie <math>\mathbb{n}(m)</math> jest najmniejszą liczbą kwadratową modulo <math>m</math>, a <math>\mathbb{n}(p_k)</math> są najmniejszymi liczbami kwadratowymi modulo <math>p_k .</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Twierdzenie to jest prostym wnioskiem z&nbsp;twierdzenia K48, ale musimy jeszcze pokazać, że <math>\gcd (\mathbb{n} (m), m) = 1 .</math> Przypuśćmy, że <math>p_k |\mathbb{n} (m)</math> dla pewnego <math>1 \leqslant k \leqslant s .</math> Ponieważ <math>\mathbb{n} (m)</math> jest liczbą pierwszą, to musi być <math>\mathbb{n} (m) = p_k</math>, ale wtedy
 
 
 
::<math>\mathbb{n} (p_k) < p_k =\mathbb{n} (m) \leqslant \mathbb{n} (p_k)</math>
 
 
 
Otrzymana sprzeczność dowodzi, że <math>\mathbb{n} (m)</math> jest względnie pierwsza z&nbsp;każdą z&nbsp;liczb pierwszych <math>p_i</math>, gdzie <math>1 \leqslant i \leqslant s .</math> Co kończy dowód.<br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K50</span><br/>
 
Niech <math>m \geqslant 3</math> będzie liczbą nieparzystą, a <math>\mathbb{n}(m)</math> jest najmniejszą liczbą niekwadratową modulo <math>m .</math> Prawdziwe są oszacowania
 
 
 
::<math>\mathbb{n}(m) < \sqrt{m} + {\small\frac{1}{2}} \qquad \qquad \qquad \;\;\, \text{dla } m \geqslant 3</math>
 
 
 
::<math>\mathbb{n}(m) \leqslant 1.1 \cdot m^{1 / 4} \log m \qquad \qquad \text{dla } m \geqslant 5</math>
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Niech <math>p</math> będzie dzielnikiem pierwszym liczby <math>m</math> takim, że <math>\mathbb{n}(m) = \mathbb{n} (p)</math> (z twierdzenia K48 wiemy, że taki dzielnik istnieje). Jeżeli prawdziwe jest oszacowanie <math>\mathbb{n}(p) < F (p)</math>, gdzie <math>F(x)</math> jest funkcją rosnącą, to
 
 
 
::<math>\mathbb{n}(m) = \mathbb{n} (p) < F (p) \leqslant F (m)</math>
 
 
 
Podane w&nbsp;twierdzeniu oszacowania wynikają natychmiast z&nbsp;twierdzeń K27 i&nbsp;K28.<br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K51</span><br/>
 
Liczby <math>\mathbb{n} (m)</math> są zaskakująco małe. Średnia wartość <math>\mathbb{n} = \mathbb{n} (m)</math> wynosi<ref name="Pollack1"/>
 
 
 
::<math>\lim_{x \to \infty} {\small\frac{1}{x}} \sum_{m \leqslant x} \mathbb{n} (m) = 2 + \sum_{k = 3}^{\infty} {\small\frac{p_k - 1}{p_1 \cdot \ldots \cdot p_{k - 1}}} = 2.920050977 \ldots</math>
 
 
 
 
 
 
 
 
 
 
 
{| style="border-spacing: 5px; border: 2px solid black; background: transparent;"
 
| &nbsp;'''C.''' Najmniejsze dodatnie liczby niekwadratowe <math>a</math> takie, że <math>\left( {\small\frac{a}{m}} \right)_{\small{\!\! J}} = - 1</math>&nbsp;
 
|}
 
 
 
<span style="font-size: 110%; font-weight: bold;">Przykład K52</span><br/>
 
W tabeli przedstawiliśmy najmniejsze liczby niekwadratowe modulo <math>p</math>, najmniejsze liczby niekwadratowe modulo <math>m</math> i&nbsp;najmniejsze dodatnie liczby niekwadratowe <math>a</math> takie, że <math>\left( {\small\frac{a}{m}} \right)_{\small{\!\! J}} = - 1</math>.
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 100%; text-align: center; margin-right: auto;"
 
! <math>\boldsymbol{m}</math>
 
| <math>3</math> || <math>5</math> || <math>7</math> || <math>9</math> || <math>11</math> || <math>13</math> || <math>15</math> || <math>17</math> || <math>19</math> || <math>21</math> || <math>23</math> || <math>25</math> || <math>27</math> || <math>29</math> || <math>31</math> || <math>33</math> || <math>35</math> || <math>37</math> || <math>39</math> || <math>41</math> || <math>43</math> || <math>45</math> || <math>47</math> || <math>49</math> || <math>51</math>
 
|-
 
!  <math>\boldsymbol{\mathbb{n}( p )}</math>
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>2</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>-</math> || <math>2</math> || <math>-</math> || <math>3</math> || <math>2</math> || <math>-</math> || <math>5</math> || <math>-</math> || <math>-</math>
 
|-
 
!  <math>\boldsymbol{\mathbb{n}( m )}</math>
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>3</math> || <math>2</math>
 
|-
 
!  <math>\boldsymbol{c( m )}</math>
 
| <math>2</math> || <math>2</math> || <math>3</math> || <math>-</math> || <math>2</math> || <math>2</math> || <math>7</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>-</math> || <math>2</math> || <math>2</math> || <math>3</math> || <math>5</math> || <math>2</math> || <math>2</math> || <math>7</math> || <math>3</math> || <math>2</math> || <math>2</math> || <math>5</math> || <math>-</math> || <math>2</math>
 
|}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K53</span><br/>
 
Do wyszukiwania liczb <math>c = c (m)</math> Czytelnik może wykorzystać prostą funkcję napisaną w&nbsp;PARI/GP
 
 
 
<span style="font-size: 90%; color:black;">C(m) =
 
 
  {
 
  {
  '''if'''( m%2 == 0, '''return'''(0) );
+
  '''local'''(D, m, P, Q);
'''if'''( '''issquare'''(m), '''return'''(0) );
+
Q = -6;
'''forprime'''(p = 2, m, '''if'''( jacobi(p, m) == -1, '''return'''(p) ));
+
'''while'''( Q++ <= 5,
 +
        '''if'''( Q == 0, '''next'''() );
 +
        P = 0;
 +
        '''while'''( P++ <= 10,
 +
              D = P^2 - 4*Q;
 +
              '''if'''( D == 0,
 +
                  '''print'''("Q= ", Q, "  P= ", P, "  ------------------");
 +
                  '''next'''();
 +
                );
 +
              m = 3;
 +
              '''while'''( m < Stop,
 +
                      '''if'''( isPrimeOr<span style="background-color: #fee481;">LPSP</span>(m, P, Q)  &&  !'''isprime'''(m),
 +
                          '''print'''("Q= ", Q, "  P= ", P, "  m= ", m, "  (D|m)= ", jacobi(D, m));
 +
                          '''break'''();
 +
                        );
 +
                      m = m + 2;
 +
                    );
 +
            );
 +
      );
 
  }</span>
 
  }</span>
 
+
<br/>
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K54</span><br/>
 
Najmniejsze dodatnie liczby niekwadratowe <math>a</math> takie, że <math>\left( {\small\frac{a}{m}} \right)_{\small{\!\! J}} = - 1</math> oznaczyliśmy jako <math>c(m)</math>. Zauważmy, że są to liczby inne od <math>\mathbb{n}(p)</math> i <math>\mathbb{n}(m)</math>. Wystarczy zwrócić uwagę na występujące w&nbsp;tabeli liczby <math>\mathbb{n}(p)</math>, <math>\mathbb{n}(m)</math> i <math>c(m)</math> dla <math>m = 15, 33, 39</math>. Różnice wynikają z&nbsp;innej definicji liczb <math>c(m)</math> – jeżeli liczba <math>a</math> jest liczbą niekwadratową modulo <math>m</math>, to symbol Jacobiego <math>\left( {\small\frac{a}{m}} \right)_{\small{\!\! J}}</math> nie musi być równy <math>- 1</math>. I&nbsp;tak czasami bywa, co bardzo dobrze pokazuje powyższa tabela.
 
 
 
Ponieważ <math>c(m)</math> nie zawsze będzie najmniejszą liczbą kwadratową modulo <math>m</math>, to mamy natychmiast oszacowanie: <math>c(m) \geqslant \mathbb{n} (m)</math> (poza przypadkami, gdy <math>m = n^2</math>).
 
 
 
Dla <math>c(m)</math> nie są prawdziwe oszacowania podane w&nbsp;twierdzeniu K27. Łatwo zauważamy, że
 
 
 
::<math>c = c (15) = 7 > \sqrt{15} + {\small\frac{1}{2}} \approx 4.37</math>
 
 
 
::<math>c = c (39) = 7 > \sqrt{39} + {\small\frac{1}{2}} \approx 6.74</math>
 
 
 
::<math>c = c (105) = 11 > \sqrt{105} + {\small\frac{1}{2}} \approx 10.75</math>
 
 
 
::<math>c = c (231) = 17 > \sqrt{231} + {\small\frac{1}{2}} \approx 15.7</math>
 
 
 
Nie ma więcej takich przypadków dla <math>m < 10^9</math>.
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K55</span><br/>
 
Niech <math>c, m \in \mathbb{Z}_+</math> i&nbsp;niech <math>m \geqslant 3</math> będzie liczbą nieparzystą, a <math>c</math> będzie najmniejszą liczbą taką, że <math>\left( {\small\frac{c}{m}} \right)_{\small{\!\! J}} = - 1</math>. Liczba <math>c</math> musi być liczbą pierwszą.
 
 
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Przypuśćmy, że <math>c = a b</math> jest liczbą złożoną, gdzie <math>1 < a, b < c</math>. Mamy
 
 
 
::<math>- 1 = \left( {\small\frac{c}{m}} \right)_{\small{\!\! J}} = \left( {\small\frac{a b}{m}} \right)_{\small{\!\! J}} = \left( {\small\frac{a}{m}} \right)_{\small{\!\! J}}</math><math>\left( {\small\frac{b}{m}} \right)_{\small{\!\! J}}</math>
 
 
 
Zatem jeden z&nbsp;czynników po prawej stronie musi być równy <math>- 1</math> wbrew definicji liczby <math>c</math>.<br/>
 
&#9633;
 
 
{{\Spoiler}}
 
{{\Spoiler}}
  
 +
Żółtym tłem oznaczyliśmy te najmniejsze liczby pseudopierwsze Lucasa, dla których <math>(D \mid m) = - 1</math>.
  
  
  
 +
<span style="font-size: 110%; font-weight: bold;">Przykład M26</span><br/>
 +
Ilość liczb LPSP(<math>P, Q</math>) mniejszych od <math>10^9</math>
  
== Liczby pierwsze postaci <math>x^2 + n y^2</math> ==
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 
+
! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<math>\boldsymbol{P}</math><br/><math>\boldsymbol{Q}</math>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="font-size: 110%; font-weight: bold;">Przykład K56</span><br/>
+
! <math>\boldsymbol{1}</math> !! <math>\boldsymbol{2}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math> !! <math>\boldsymbol{10}</math>
Przedstawiamy wszystkie rozkłady liczb naturalnych nie większych od <math>85</math> na sumę postaci <math>x^2 + y^2</math>, gdzie <math>x, y \in \mathbb{N}_0</math>. Rozkłady różniące się jedynie kolejnością liczb <math>x , y</math> nie zostały uwzględnione.
 
 
 
{| class="wikitable plainlinks"  style="font-size: 70%; text-align: center; margin-right: auto;"
 
 
|-
 
|-
! <math>\boldsymbol{n}</math>  
+
! <math>\boldsymbol{- 5}</math>
| <math>1</math> || style="background-color: #99cc66" | <math>2</math> || <math>4</math> || style="background-color: #99cc66" | <math>5</math> || <math>8</math> || <math>9</math> || <math>10</math> || style="background-color: #99cc66" | <math>13</math> || <math>16</math> || style="background-color: #99cc66" | <math>17</math> || <math>18</math> || <math>20</math> || <math>25</math> || <math>26</math> || style="background-color: #99cc66" | <math>29</math> || <math>32</math> || <math>34</math> || <math>36</math> || style="background-color: #99cc66" | <math>37</math> || <math>40</math> || style="background-color: #99cc66" | <math>41</math> || <math>45</math> || <math>49</math> || <math>50</math> || <math>52</math> || style="background-color: #99cc66" | <math>53</math> || <math>58</math> ||style="background-color: #99cc66" | <math>61</math> || <math>64</math> || <math>65</math> || <math>68</math> || <math>72</math> || style="background-color: #99cc66" | <math>73</math> || <math>74</math> || <math>80</math> || <math>81</math> || <math>82</math> || <math>85</math>
+
| <math>4266</math> || <math>4935</math> || <math>4278</math> || <math>4981</math> || <math>6363</math> || <math>6028</math> || <math>5202</math> || <math>4426</math> || <math>5832</math> || <math>6027</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{- 4}</math>
| <math>1,0</math> || <math>1,1</math> || <math>2,0</math> || <math>2,1</math> || <math>2,2</math> || <math>3,0</math> || <math>3,1</math> || <math>3,2</math> || <math>4,0</math> || <math>4,1</math> || <math>3,3</math> || <math>4,2</math> || <math>5,0</math> || <math>5,1</math> || <math>5,2</math> || <math>4,4</math> || <math>5,3</math> || <math>6,0</math> || <math>6,1</math> || <math>6,2</math> || <math>5,4</math> || <math>6,3</math> || <math>7,0</math> || <math>7,1</math> || <math>6,4</math> || <math>7,2</math> || <math>7,3</math> || <math>6,5</math> || <math>8,0</math> || <math>8,1</math> || <math>8,2</math> || <math>6,6</math> || <math>8,3</math> || <math>7,5</math> || <math>8,4</math> || <math>9,0</math> || <math>9,1</math> || <math>9,2</math>
+
| <math>4599</math> || <math>4152</math> || <math>9272</math> || <math>5886</math> || <math>6958</math> || <math>4563</math> || <math>5600</math> || <math>9509</math> || <math>7007</math> || <math>4142</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{- 3}</math>
| <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>4,3</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>5,5</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>7,4</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>7,6</math>
+
| <math>4265</math> || <math>5767</math> || <math>4241</math> || <math>5114</math> || <math>5859</math> || <math>7669</math> || <math>6083</math> || <math>6120</math> || <math>4420</math> || <math>5096</math>  
|}
 
 
 
Zauważmy, że liczba złożona <math>21</math> nie ma rozkładu na sumę kwadratów, a&nbsp;liczba złożona <math>65</math> ma dwa takie rozkłady. Obie liczby są postaci <math>4 k + 1</math>.
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Przykład K57</span><br/>
 
Przedstawiamy wszystkie rozkłady liczb naturalnych nie większych od <math>73</math> na sumę postaci <math>x^2 + 2 y^2</math>, gdzie <math>x, y \in \mathbb{N}_0</math>.
 
 
 
{| class="wikitable plainlinks"  style="font-size: 70%; text-align: center; margin-right: auto;"
 
 
|-
 
|-
! <math>\boldsymbol{n}</math>  
+
! <math>\boldsymbol{- 2}</math>
| <math>1</math> || style="background-color: #99cc66" | <math>2</math> || style="background-color: #99cc66" | <math>3</math> || <math>4</math> || <math>6</math> || <math>8</math> || <math>9</math> || style="background-color: #99cc66" | <math>11</math> || <math>12</math> || <math>16</math> || style="background-color: #99cc66" | <math>17</math> || <math>18</math> || style="background-color: #99cc66" | <math>19</math> || <math>22</math> || <math>24</math> || <math>25</math> || <math>27</math> || <math>32</math> || <math>33</math> || <math>34</math> || <math>36</math> || <math>38</math> || style="background-color: #99cc66" | <math>41</math> || style="background-color: #99cc66" | <math>43</math> || <math>44</math> || <math>48</math> || <math>49</math> || <math>50</math> || <math>51</math> || <math>54</math> || <math>57</math> || style="background-color: #99cc66" | <math>59</math> || <math>64</math> || <math>66</math> || style="background-color: #99cc66" | <math>67</math> || <math>68</math> || <math>72</math> || style="background-color: #99cc66" | <math>73</math>
+
| <math>5361</math> || <math>4389</math> || <math>5063</math> || <math>5632</math> || <math>5364</math> || <math>5228</math> || <math>5859</math> || <math>10487</math> || <math>5370</math> || <math>9798</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{- 1}</math>
| <math>1,0</math> || <math>0,1</math> || <math>1,1</math> || <math>2,0</math> || <math>2,1</math> || <math>0,2</math> || <math>3,0</math> || <math>3,1</math> || <math>2,2</math> || <math>4,0</math> || <math>3,2</math> || <math>4,1</math> || <math>1,3</math> || <math>2,3</math> || <math>4,2</math> || <math>5,0</math> || <math>5,1</math> || <math>0,4</math> || <math>5,2</math> || <math>4,3</math> || <math>6,0</math> || <math>6,1</math> || <math>3,4</math> || <math>5,3</math> || <math>6,2</math> || <math>4,4</math> || <math>7,0</math> || <math>0,5</math> || <math>7,1</math> || <math>6,3</math> || <math>7,2</math> || <math>3,5</math> || <math>8,0</math> || <math>8,1</math> || <math>7,3</math> || <math>6,4</math> || <math>8,2</math> || <math>1,6</math>
+
| <math>4152</math> || <math>5886</math> || <math>4563</math> || <math>9509</math> || <math>4142</math> || <math>6273</math> || <math>5773</math> || <math>4497</math> || <math>5166</math> || <math>5305</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{1}</math>
| <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>1,2</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>0,3</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>3,3</math> || <math></math> || <math>1,4</math> || <math></math> || <math>2,4</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>1,5</math> || <math>2,5</math> || <math>5,4</math> || <math></math> || <math></math> || <math>4,5</math> || <math></math> || <math></math> || <math>0,6</math> || <math></math>
+
| <math>282485800</math> || style="background-color: red" | <math></math> || <math>6567</math> || <math>7669</math> || <math>7131</math> || <math>10882</math> || <math>8626</math> || <math>8974</math> || <math>8509</math> || <math>8752</math>  
|}
 
 
 
Zauważmy, że liczba złożona <math>65</math> nie ma rozkładu na sumę postaci <math>x^2 + 2 y^2</math>, a&nbsp;liczba złożona <math>33</math> ma dwa takie rozkłady. Obie liczby są postaci <math>8 k + 1</math>.
 
 
 
Zauważmy też, że liczba złożona <math>35</math> nie ma rozkładu na sumę postaci <math>x^2 + 2 y^2</math>, a&nbsp;liczba złożona <math>27</math> ma dwa takie rozkłady. Obie liczby są postaci <math>8 k + 3</math>.
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Przykład K58</span><br/>
 
Przedstawiamy wszystkie rozkłady liczb naturalnych nie większych od <math>103</math> na sumę postaci <math>x^2 + 3 y^2</math>, gdzie <math>x, y \in \mathbb{N}_0</math>.
 
 
 
{| class="wikitable plainlinks"  style="font-size: 70%; text-align: center; margin-right: auto;"
 
 
|-
 
|-
! <math>\boldsymbol{n}</math>  
+
! <math>\boldsymbol{2}</math>
| <math>1</math> || style="background-color: #99cc66" | <math>3</math> || <math>4</math> || style="background-color: #99cc66" | <math>7</math> || <math>9</math> || <math>12</math> || style="background-color: #99cc66" | <math>13</math> || <math>16</math> || style="background-color: #99cc66" | <math>19</math> || <math>21</math> || <math>25</math> || <math>27</math> || <math>28</math> || style="background-color: #99cc66" | <math>31</math> || <math>36</math> || style="background-color: #99cc66" | <math>37</math> || <math>39</math> || style="background-color: #99cc66" | <math>43</math> || <math>48</math> || <math>49</math> || <math>52</math> || <math>57</math> || style="background-color: #99cc66" | <math>61</math> || <math>63</math> || <math>64</math> || style="background-color: #99cc66" | <math>67</math> || style="background-color: #99cc66" | <math>73</math> || <math>75</math> || <math>76</math> || style="background-color: #99cc66" | <math>79</math> || <math>81</math> || <math>84</math> || <math>91</math> || <math>93</math> || style="background-color: #99cc66" | <math>97</math> || <math>100</math> || style="background-color: #99cc66" | <math>103</math>
+
| <math>7803</math> || <math>449152466</math> || <math>5597</math> || <math>5886</math> || <math>6509</math> || <math>5761</math> || <math>8115</math> || <math>6945</math> || <math>8380</math> || <math>7095</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{3}</math>
| <math>1,0</math> || <math>0,1</math> || <math>2,0</math> || <math>2,1</math> || <math>3,0</math> || <math>3,1</math> || <math>1,2</math> || <math>4,0</math> || <math>4,1</math> || <math>3,2</math> || <math>5,0</math> || <math>0,3</math> || <math>5,1</math> || <math>2,3</math> || <math>6,0</math> || <math>5,2</math> || <math>6,1</math> || <math>4,3</math> || <math>6,2</math> || <math>7,0</math> || <math>7,1</math> || <math>3,4</math> || <math>7,2</math> || <math>6,3</math> || <math>8,0</math> || <math>8,1</math> || <math>5,4</math> || <math>0,5</math> || <math>8,2</math> || <math>2,5</math> || <math>9,0</math> || <math>9,1</math> || <math>8,3</math> || <math>9,2</math> || <math>7,4</math> || <math>10,0</math> || <math>10,1</math>
+
| <math>5974</math> || <math>8768</math> || <math>282485800</math> || <math>5767</math> || <math>5651</math> || <math>5632</math> || <math>6640</math> || <math>5725</math> || <math>6058</math> || <math>7050</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{4}</math>
| <math></math> || <math></math> || <math>1,1</math> || <math></math> || <math></math> || <math>0,2</math> || <math></math> || <math>2,2</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>4,2</math> || <math></math> || <math>3,3</math> || <math></math> || <math></math> || <math></math> || <math>0,4</math> || <math>1,4</math> || <math>5,3</math> || <math></math> || <math></math> || <math></math> || <math>4,4</math> || <math></math> || <math></math> || <math></math> || <math>7,3</math> || <math></math> || <math></math> || <math>6,4</math> || <math>4,5</math> || <math></math> || <math></math> || <math>5,5</math> || <math></math>
+
| <math>10749</math> || <math>282485800</math> || <math>14425</math> || style="background-color: red" | <math></math> || <math>9735</math> || <math>6567</math> || <math>8164</math> || <math>7669</math> || <math>7608</math> || <math>7131</math>  
 
|-
 
|-
! <math>\boldsymbol{x,y}</math>  
+
! <math>\boldsymbol{5}</math>
| <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>1,3</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>2,4</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math> || <math>1,5</math> || <math></math> || <math></math> || <math>3,5</math> || <math></math> || <math></math> || <math></math> || <math></math> || <math></math>
+
| <math>5047</math> || <math>15127</math> || <math>6155</math> || <math>15127</math> || <math>4152</math> || <math>5146</math> || <math>4423</math> || <math>5526</math> || <math>6289</math> || <math>9509</math>  
 
|}
 
|}
  
Zauważmy, że liczba złożona <math>55</math> nie ma rozkładu na sumę postaci <math>x^2 + 3 y^2</math>, a&nbsp;liczba złożona <math>91</math> ma dwa takie rozkłady. Obie liczby są postaci <math>6 k + 1</math>.
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 +
<span style="font-size: 90%; color:black;">NumOfLPSP(Stop) =
 +
\\ ilość liczb pseudopierwszych Lucasa LPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
 +
{
 +
'''local'''(D, m, P, Q);
 +
Q = -6;
 +
'''while'''( Q++ <= 5,
 +
        '''if'''( Q == 0, '''next'''() );
 +
        P = 0;
 +
        '''while'''( P++ <= 10,
 +
              D = P^2 - 4*Q;
 +
              '''if'''( D == 0, '''print'''("Q= ", Q, "  P= ", P, "  ------------------"); '''next'''() );
 +
              s = 0;
 +
              m = 3;
 +
              '''while'''( m < Stop,
 +
                      '''if'''( isPrimeOr<span style="background-color: #fee481;">LPSP</span>(m, P, Q)  &&  !'''isprime'''(m), s++ );
 +
                      m = m + 2;
 +
                    );
 +
              '''print'''("Q= ", Q, "  P= ", P, "  s= ", s);
 +
            );
 +
      );
 +
}</span>
 +
<br/>
 +
{{\Spoiler}}
  
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K59</span><br/>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M27</span><br/>
Jeżeli liczba nieparzysta postaci <math>Q = x^2 + n y^2</math>, gdzie <math>n \in \{ 1, 2, 3 \}</math>, ma dwa różne takie przedstawienia w&nbsp;liczbach całkowitych dodatnich, to jest liczbą złożoną.
+
Dla <math>(P, Q) = (1, 1)</math> ciąg Lucasa <math>(U_n)</math> ma postać
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
::<math>(U_n) = (0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, \ldots)</math>
W dowodzie wyróżniliśmy miejsca, które wymagają oddzielnej analizy ze względu na wartość liczby <math>n</math>.
 
  
Niech
+
Stosując indukcję matematyczną, udowodnimy, że <math>U_{3 k} = 0</math>. Łatwo sprawdzamy, że dla <math>k = 0</math> i <math>k = 1</math> wzór jest prawdziwy. Zakładając prawdziwość wzoru dla wszystkich liczb naturalnych nie większych od <math>k</math>, otrzymujemy dla <math>k + 1</math> (zobacz M13 p.3)
  
::<math>Q = x^2 + n y^2 = a^2 + n b^2</math>
+
::<math>U_{3 (k + 1)} = U_{3 k + 3} = U_{3 k} V_3 - U_{3 (k - 1)} = 0</math>
  
<div style="border: thin solid black; padding-top: 0em; margin-top: 0.5em; padding-bottom: 0em; margin-bottom: 0.5em;">
+
Co kończy dowód. Zbadajmy liczby pseudopierwsze Lucasa dla <math>(P, Q) = (1, 1)</math>.
<math>\boldsymbol{n = 1}</math>
 
  
Z założenia <math>Q</math> jest liczbą nieparzystą, zatem liczby występujące w&nbsp;rozkładach <math>x^2 + y^2 = a^2 + b^2</math> muszą mieć przeciwną parzystość. Nie zmniejszając ogólności, możemy założyć, że liczby <math>x, a</math> są nieparzyste, a&nbsp;liczby <math>y, b</math> parzyste.
+
Mamy <math>D = P^2 - 4 Q = - 3</math>. Wynika stąd, że nie może być <math>3 \mid m</math>, bo mielibyśmy <math>\gcd (m, Q D) = 3 > 1</math>.
  
<math>\boldsymbol{n = 2}</math>
+
Z zadania J42 wiemy, że
  
Z założenia <math>Q</math> jest liczbą nieparzystą, zatem liczby <math>x, a</math> występująca w&nbsp;rozkładach <math>x^2 + 2 y^2 = a^2 + 2 b^2</math> muszą być nieparzyste. Pokażemy, że liczby <math>y, b</math> muszą mieć taką samą parzystość. Przypuśćmy, że <math>y</math> jest parzysta, a <math>b</math> nieparzysta, wtedy modulo <math>4</math> dostajemy
+
::<math>(- 3 \mid m) =
 +
\begin{cases}
 +
\;\;\: 1 & \text{gdy } m = 6 k + 1 \\
 +
\;\;\: 0 & \text{gdy } m = 6 k + 3 \\
 +
      - 1 & \text{gdy } m = 6 k + 5
 +
\end{cases}</math>
  
::<math>1 + 2 \cdot 0 \equiv 1 + 2 \cdot 1 \!\! \pmod{4}</math>
+
Ponieważ <math>3 \nmid m</math>, to wystarczy zbadać przypadki <math>m = 6 k + 1</math> i <math>m = 6 k + 5</math>. W&nbsp;pierwszym przypadku jest
  
Co jest niemożliwe.
+
::<math>U_{m - (- 3 \mid m)} = U_{6 k + 1 - 1} = U_{6 k} = 0</math>
  
<math>\boldsymbol{n = 3}</math>
+
W drugim przypadku, gdy <math>m = 6 k + 5</math>, dostajemy
  
Z założenia <math>Q</math> jest liczbą nieparzystą, zatem liczby występujące w&nbsp;rozkładach <math>x^2 + 3 y^2 = a^2 + 3 b^2</math> muszą mieć przeciwną parzystość. Pokażemy, że liczby <math>x, a</math> muszą mieć taką samą parzystość. Gdyby liczba <math>x</math> była nieparzysta, a&nbsp;liczba <math>a</math> parzysta, to modulo <math>4</math> mielibyśmy
+
::<math>U_{m - (- 3 \mid m)} = U_{6 k + 5 + 1} = U_{6 (k + 1)} = 0</math>
  
::<math>1 + 3 \cdot 0 \equiv 0 + 3 \cdot 1 \!\! \pmod{4}</math>
+
Zatem dla dowolnej liczby nieparzystej <math>m</math> niepodzielnej przez <math>3</math> jest
  
Co jest niemożliwe.
+
::<math>U_{m - (- 3 \mid m)} \equiv 0 \pmod{m}</math>
</div>
 
Z powyższego zestawienia wynika, że liczby <math>x, a</math> i liczby <math>y, b</math> mają taką samą parzystość. Mamy
 
  
::<math>x^2 - a^2 = n (b^2 - y^2)</math>
+
Czyli liczbami pseudopierwszymi Lucasa dla parametrów <math>(P, Q) = (1, 1)</math> będą liczby nieparzyste <math>m</math>, które nie są podzielne przez <math>3</math> i&nbsp;nie są liczbami pierwszymi. Ilość takich liczb nie większych od <math>10^k</math> możemy łatwo znaleźć poleceniem
  
::<math>(x - a) (x + a) = n (b - y) (b + y)</math>
+
'''for'''(k = 1, 9, s = 0; '''forstep'''(m = 3, 10^k, 2, '''if'''( m%6 <> 3, s = s + !'''isprime'''(m) )); '''print'''(s))
  
Niech <math>f = \gcd (x - a, b - y)</math>, zatem <math>f</math> jest liczbą parzystą i
 
  
::<math>x - a = f r , \qquad \qquad b - y = f s , \qquad \qquad \gcd (r, s) = 1</math>
 
  
Czyli
+
<span style="font-size: 110%; font-weight: bold;">Zadanie M28</span><br/>
 +
Pokazać, że ilość liczb pseudopierwszych Lucasa dla parametrów <math>(P, Q) = (2, 2)</math> nie większych od <math>10^k</math> możemy znaleźć poleceniem
  
::<math>r(x + a) = n s (y + b)</math>
+
'''for'''(k = 1, 9, s = 0; '''forstep'''(m = 3, 10^k, 2, s = s + !'''isprime'''(m)); '''print'''(s))
  
ale liczby <math>r, s</math> są względnie pierwsze, zatem <math>s \mid (x + a)</math> i&nbsp;musi być
 
  
::<math>x + a = k s \qquad \qquad \Longrightarrow \qquad \qquad n (y + b) = k r</math>
 
  
Gdyby <math>k</math> było liczbą nieparzystą, to liczby <math>r, s</math> musiałyby być parzyste, co jest niemożliwe, bo <math>\gcd (r, s) = 1</math>. Zatem <math>k</math> jest liczbą parzystą i <math>2 s \mid (x + a)</math>, czyli możemy pokazać więcej. Musi być
 
  
::<math>x + a = 2 l s \qquad \qquad \Longrightarrow \qquad \qquad n (y + b) = 2 l r</math>
 
  
W przypadku gdy <math>n = 2</math> lub <math>n = 3</math>, zauważmy, że <math>n \mid l</math> lub <math>n \mid r</math>.
+
== Metoda Selfridge'a wyboru parametrów <math>P</math> i <math>Q</math> ==
  
Łatwo otrzymujemy
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M29</span><br/>
 +
Twierdzenie M20 możemy wykorzystać do testowania pierwszości liczb. Ponieważ musi być spełniony warunek <math>\gcd (m, Q D) = 1</math>, to nie każda para liczb <math>P, Q</math> (np. wybrana losowo) nadaje się do przeprowadzenia testu. Zawsze będziemy zmuszeni określić zasadę postępowania, która doprowadzi do wyboru właściwej pary <math>P, Q</math>.
  
::<math>x = {\small\frac{1}{2}} (2 l s + f r)</math>
+
Robert Baillie i&nbsp;Samuel Wagstaff przedstawili<ref name="BaillieWagstaff1"/> dwie metody wyboru parametrów dla testu Lucasa. Ograniczymy się do omówienia tylko pierwszej z&nbsp;nich (metodę zaproponował John Selfridge).
  
::<math>y = {\small\frac{1}{2 n}} (2 l r - n f s)</math>
+
Rozważmy ciąg <math>a_k = (- 1)^k (2 k + 1)</math>, gdzie <math>k \geqslant 2</math>, czyli <math>a_k = (5, - 7, 9, - 11, 13, - 15, \ldots)</math>. Niech <math>D</math> będzie pierwszym wyrazem ciągu <math>(a_k)</math>, dla którego jest <math>(a_k \mid m) = - 1</math>. Dla tak ustalonego <math>D</math> przyjmujemy <math>P = 1</math> i <math>Q = (1 - D) / 4</math>.
  
Ostatecznie
+
Tabela przedstawia początkowe wartości <math>Q</math>, jakie otrzymamy, stosując tę metodę.
  
::<math>Q = x^2 + n y^2</math>
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 +
! <math>\boldsymbol{k}</math>
 +
| <math>2</math> || <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math> || <math>16</math> || <math>17</math> || <math>18</math> || <math>19</math> || <math>20</math>
 +
|-
 +
!  <math>\boldsymbol{a_k}</math>
 +
| <math>5</math> || <math>-7</math> || <math>9</math> || <math>-11</math> || <math>13</math> || <math>-15</math> || <math>17</math> || <math>-19</math> || <math>21</math> || <math>-23</math> || <math>25</math> || <math>-27</math> || <math>29</math> || <math>-31</math> || <math>33</math> || <math>-35</math> || <math>37</math> || <math>-39</math> || <math>41</math>
 +
|-
 +
!  <math>\boldsymbol{Q}</math>
 +
| <math>-1</math> || <math>2</math> || style="background-color: red" | <math>-2</math> || <math>3</math> || <math>-3</math> || <math>4</math> || <math>-4</math> || <math>5</math> || <math>-5</math> || <math>6</math> || style="background-color: red" | <math>-6</math> || <math>7</math> || <math>-7</math> || <math>8</math> || <math>-8</math> || <math>9</math> || <math>-9</math> || <math>10</math> || <math>-10</math>
 +
|}
  
::<math>\;\;\;\: = \left[ {\small\frac{1}{2}} (2 l s + f r) \right]^2 + n \left[ {\small\frac{1}{2 n}} (2 l r - n f s) \right]^2</math>
 
  
::<math>\;\;\;\: = {\small\frac{1}{4 n}} [n (2 l s + f r)^2 + (2 l r - n f s)^2]</math>
+
Zauważmy, że
 +
:* jeżeli liczba nieparzysta <math>m</math> jest liczbą kwadratową, to wybór <math>D</math> nie będzie możliwy
 +
:* w&nbsp;przypadku zastosowania tej metody znajdziemy tylko liczby pierwsze lub pseudopierwsze Lucasa, które spełniają kongruencję <math>U_{m + 1} \equiv 0 \pmod{m}</math>, czyli tylko część liczb pseudopierwszych Lucasa określonych w&nbsp;definicji M22
  
::<math>\;\;\;\: = {\small\frac{1}{4 n}} [n (2 l s)^2 + n (f r)^2 + (2 l r)^2 + (n f s)^2]</math>
 
  
::<math>\;\;\;\: = {\small\frac{1}{4 n}} [(2 l)^2 + n f^2] (r^2 + n s^2)</math>
+
Ponieważ Baillie i&nbsp;Wagstaff określili metodę zaproponowaną przez Selfridge'a jako metodę A, to pozostaniemy przy tej nazwie. Korzystając ze wzoru rekurencyjnego
  
<div style="border: thin solid black; padding-top: 0em; margin-top: 0.5em; padding-bottom: 0em; margin-bottom: 0.5em;">
+
::<math> a_{k+1} =
<math>\boldsymbol{n = 1}</math>
+
  \begin{cases}
 +
  \qquad \qquad 5 & \text{gdy } k = 1\\
 +
      - a_k - 2 * \mathop{\textnormal{sign}}( a_k ) & \text{gdy } k \geqslant 2
 +
  \end{cases}</math>
  
::<math>Q = {\small\frac{1}{4}} [(2 l)^2 + f^2] (r^2 + s^2) = \left[ l^2 + \left( {\small\frac{f}{2}} \right)^2 \right] (r^2 + s^2)</math>
+
możemy łatwo napisać odpowiednią funkcję znajdującą liczby <math>P, Q</math> według tej metody.
  
<math>\boldsymbol{n = 2 , 3}</math>
+
<span style="font-size: 90%; color:black;">MethodA(m) =
 +
{
 +
'''local'''(a, js);
 +
a = 5;
 +
'''while'''( 1,
 +
        js = jacobi(a, m);
 +
        '''if'''( js == 0  &&  a % m <> 0, '''return'''([0, 0]) );
 +
        '''if'''( js == -1, '''return'''([1, (1 - a)/4]) );
 +
        a = -a - 2*'''sign'''(a);
 +
      );
 +
}</span>
  
W zależności od tego, która z&nbsp;liczb <math>l, r</math> jest podzielna przez <math>n</math>, możemy napisać
+
Wyjaśnienia wymaga druga linia kodu w&nbsp;pętli <code>while</code>. Wiemy, że (zobacz J38)
  
::<math>Q = {\small\frac{1}{4 n}} [(2 l)^2 + n f^2] (r^2 + n s^2) = \left[ {\small\frac{(2 l)^2 + n f^2}{4 n}} \right] (r^2 + n s^2) = \left[ {\small\frac{(2 l)^2 + n f^2}{4}} \right] \left( {\small\frac{r^2 + n s^2}{n}} \right)</math>
+
::<math>(a \mid m) = 0 \quad \qquad \Longleftrightarrow \quad \qquad \gcd (a, m) > 1</math>
</div>
 
  
Co kończy dowód.<br/>
+
Jednak z&nbsp;faktu, że <math>\gcd (a, m) > 1</math> nie wynika natychmiast, że liczba <math>m</math> jest liczbą złożoną. Rozważmy dwa przypadki: gdy <math>m \mid a</math> i <math>m \nmid a</math>.
&#9633;
 
{{\Spoiler}}
 
  
 +
Gdy <math>\gcd (a, m) > 1</math> i <math>m \mid a</math>, to <math>\gcd (a, m) = \gcd (k \cdot m, m) = m > 1</math> i&nbsp;nie jesteśmy w&nbsp;stanie rozstrzygnąć, czy liczba <math>m</math> jest liczbą pierwszą, czy złożoną. Widać to dobrze na prostych przykładach
  
 +
::<math>\gcd (7, 7) = \gcd (14, 7) = 7 > 1</math>
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K60</span><br/>
+
::<math>\gcd (15, 15) = \gcd (30, 15) = 15 > 1</math>
Zauważmy, że iloczyn liczb postaci <math>x^2 + n y^2</math> jest liczbą tej samej postaci.
 
  
::<math>(a^2 + n b^2) (x^2 + n y^2) = (a x + n b y)^2 + n (a y - b x)^2</math>
+
Gdy <math>\gcd (a, m) > 1</math> i <math>m \nmid a</math>, to <math>m</math> jest liczbą złożoną. Ponieważ <math>m \nmid a</math>, to <math>a = k \cdot m + r</math>, gdzie <math>r \in [1, m - 1]</math>. Mamy
  
::::::::<math>\;\;\;\:\, = (a x - n b y)^2 + n (a y + b x)^2</math>
+
::<math>\gcd (a, m) = \gcd (k \cdot m + r, m) = \gcd (r, m) = d</math>
  
 +
Musi być <math>d > 1</math>, bo założyliśmy, że <math>\gcd (a, m) > 1</math> i&nbsp;musi być <math>d < m</math>, bo <math>d \leqslant r \leqslant m - 1</math>. Zatem <math>d</math> jest dzielnikiem nietrywialnym liczby <math>m</math> i <math>m</math> jest liczbą złożoną.
  
 +
Omawiana linia kodu zapewnia wysłanie informacji o&nbsp;tym, że liczba <math>m</math> jest liczbą złożoną (zwrot wektora [0, 0]). W&nbsp;przypadku, gdy nie mamy takiej pewności, kontynuujemy szukanie liczby <math>a</math>, takiej że <math>(a \mid m) = - 1</math>, pozostawiając zbadanie pierwszości liczby <math>m</math> na kolejnym etapie testowania.
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K61</span><br/>
 
Niech <math>x, y, a, b \in \mathbb{Z}</math> i <math>n \in \{ 1, 2, 3 \}</math>. Jeżeli liczba parzysta <math>Q = x^2 + n y^2</math>, to <math>Q = 2^{\alpha} R</math>, gdzie <math>R = a^2 + n b^2</math> jest liczbą nieparzystą.
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
Uważny Czytelnik dostrzeże, że nie zbadaliśmy, czy spełniony jest warunek <math>\gcd (m, Q) = 1</math>. Nie musimy tego robić, bo zwracana przez funkcję <code>MethodA()</code> liczba <math>Q</math> jest względnie pierwsza z <math>m</math>. Omówimy ten problem dokładnie w&nbsp;zadaniu M30. Poniżej pokażemy, że nawet gdyby było <math>\gcd (m, Q) > 1</math>, to złożona liczba <math>m</math> nie zostanie uznana za liczbę pseudopierwszą Lucasa.
W szczególnym przypadku, gdy <math>R = 1</math>, mamy <math>R = 1^2 + n \cdot 0^2</math>.
 
  
Dowód sprowadza się do podania wzorów, które pozwalają obniżyć wykładnik, z&nbsp;jakim liczba <math>2</math> występuje w&nbsp;rozwinięciu na czynniki pierwsze liczby <math>Q</math>. Zauważmy, że wynik jest zawsze liczbą, której postać jest taka sama, jak postać liczby <math>Q</math>. Stosując te wzory odpowiednią ilość razy, otrzymujmy rozkład <math>Q = 2^{\alpha} R</math>, gdzie <math>R</math> jest liczbą nieparzystą postaci <math>a^2 + n b^2</math>.
+
Zauważmy, że jeżeli <math>m</math> jest liczbą złożoną i&nbsp;ma dzielnik pierwszy <math>p < m</math>, który dzieli <math>Q</math>, to <math>p \mid Q</math> i <math>p \nmid P</math> (bo <math>P = 1</math>), zatem <math>p \nmid U_k</math> dla <math>k \geqslant 1</math> (zobacz M17), czyli nie może być
  
'''1.''' <math>\boldsymbol{Q = x^2 + y^2}</math>
+
::<math>U_{m + 1} (1, Q) \equiv 0 \pmod{m}</math>
  
a) jeżeli liczby <math>x, y</math> są parzyste, to <math>{\small\frac{Q}{4}} = \left( {\small\frac{x}{2}} \right)^2 + \left( {\small\frac{y}{2}} \right)^2</math>
+
bo mielibyśmy
  
b) jeżeli liczby <math>x, y</math> są nieparzyste, to <math>{\small\frac{Q}{2}} = \left( {\small\frac{x + y}{2}} \right)^2 + \left( {\small\frac{x - y}{2}} \right)^2</math>
+
::<math>U_{m + 1} (1, Q) \equiv 0 \pmod{p}</math>
  
'''2.''' <math>\boldsymbol{Q = x^2 + 2 y^2}</math>
+
a to jest niemożliwe. Zatem program wykorzystujący twierdzenie M20 wykryje złożoność liczby <math>m</math>.
  
a) jeżeli liczby <math>x, y</math> są parzyste, to <math>{\small\frac{Q}{4}} = \left( {\small\frac{x}{2}} \right)^2 + 2 \left( {\small\frac{y}{2}} \right)^2</math>
+
Łatwo pokażemy, że nie jest możliwe, aby liczba <math>m</math> była liczbą pierwszą i&nbsp;była dzielnikiem <math>Q</math>. Jeżeli <math>m</math> jest liczbą pierwszą, to istnieje dokładnie <math>\tfrac{m - 1}{2}</math> liczb kwadratowych modulo <math>p</math> i <math>\tfrac{m - 1}{2}</math> liczb niekwadratowych modulo <math>p</math>, zatem rozpoczynając od wyrazu <math>a_2</math> możemy dojść co najwyżej do wyrazu o&nbsp;indeksie <math>k = \tfrac{m - 1}{2} + 2</math>, czyli
  
b) jeżeli liczba <math>x</math> jest parzysta, a <math>y</math> nieparzysta, to <math>{\small\frac{Q}{2}} = y^2 + 2 \left( {\small\frac{x}{2}} \right)^2</math>
+
::<math>| a_k | \leqslant m + 4</math>
  
'''3.''' <math>\boldsymbol{Q = x^2 + 3 y^2}</math>
+
Skąd wynika, że
  
a) jeżeli liczby <math>x, y</math> są parzyste, to <math>{\small\frac{Q}{4}} = \left( {\small\frac{x}{2}} \right)^2 + 3 \left( {\small\frac{y}{2}} \right)^2</math>
+
::<math>| Q | = \left| {\small\frac{1 - a_k}{4}} \right| \leqslant {\small\frac{m + 5}{4}} < m</math>
  
b) jeżeli liczby <math>x, y</math> są nieparzyste i <math>4 \mid (x + y)</math>, to <math>{\small\frac{Q}{4}} = \left( {\small\frac{x - 3 y}{4}} \right)^2 + 3 \left( {\small\frac{x + y}{4}} \right)^2</math>
+
Ostatnia nierówność jest prawdziwa dla <math>m > {\small\frac{5}{3}}</math>, czyli dla wszystkich liczb pierwszych. Ponieważ <math>| Q | < m</math>, w&nbsp;przypadku gdy <math>m</math> jest liczbą pierwszą, to <math>m</math> nie może być dzielnikiem liczby <math>Q</math>.
  
c) jeżeli liczby <math>x, y</math> są nieparzyste i <math>4 \mid (x - y)</math>, to <math>{\small\frac{Q}{4}} = \left( {\small\frac{x + 3 y}{4}} \right)^2 + 3 \left( {\small\frac{x - y}{4}} \right)^2</math>
 
  
Co należało pokazać.<br/>
 
&#9633;
 
{{\Spoiler}}
 
  
 +
<span style="font-size: 110%; font-weight: bold;">Zadanie M30</span><br/>
 +
Pokazać, że w&nbsp;przypadku, gdy dla kolejnych liczb <math>a_k = (- 1)^k (2 k + 1)</math> sprawdzamy, czy konsekwencją <math>(a_k \mid m) = 0</math> jest złożoność liczby <math>m</math>, to dla każdej liczby <math>Q</math> wyznaczonej metodą Selfridge'a jest <math>\gcd (Q, m) = 1</math>.
  
 +
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 +
Niech <math>m = 21</math>. Rozpoczniemy od przykładu liczb <math>a_k = (- 1)^k (2 k + 1)</math> dla <math>k = 0, 1, \ldots, m - 1</math>.
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K62</span><br/>
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
Liczba pierwsza <math>p \geqslant 3</math> jest postaci
+
! <math>\boldsymbol{k}</math> !! <math>\boldsymbol{0}</math> !!  !!  !!  !!  !!  !!  !!  !!  !!  !! <math>\boldsymbol{(m-1)/2}</math> !!  !!  !!  !!  !!  !!  !!  !!  !!  !! <math>\boldsymbol{m-1}</math>
 +
|-
 +
! <math>\boldsymbol{k}</math>
 +
| <math>0</math> || <math>1</math> || <math>2</math> || <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math> || <math>16</math> || <math>17</math> || <math>18</math> || <math>19</math> || <math>20</math>
 +
|-
 +
! <math>\boldsymbol{a_k}</math>
 +
| <math>1</math> || <math>-3</math> || <math>5</math> || <math>-7</math> || <math>9</math> || <math>-11</math> || <math>13</math> || <math>-15</math> || <math>17</math> || <math>-19</math> || <math>21</math> || <math>-23</math> || <math>25</math> || <math>-27</math> || <math>29</math> || <math>-31</math> || <math>33</math> || <math>-35</math> || <math>37</math> || <math>-39</math> || <math>41</math>
 +
|-
 +
! <math>\boldsymbol{R_m(a_k)}</math>
 +
| <math>1</math> || <math>18</math> || <math>5</math> || <math>14</math> || <math>9</math> || <math>10</math> || <math>13</math> || <math>6</math> || <math>17</math> || <math>2</math> || <math>0</math> || <math>19</math> || <math>4</math> || <math>15</math> || <math>8</math> || <math>11</math> || <math>12</math> || <math>7</math> || <math>16</math> || <math>3</math> || <math>20</math>
 +
|}
  
:(a)&nbsp;&nbsp;<math>4 k + 1</math>
+
Zauważmy, że modulo <math>21</math> ciąg <math>(a_k) = (1, - 3, 5, - 7, \ldots, 37, - 39, 41)</math> jest identyczny z&nbsp;ciągiem <math>(0, 1, 2, \ldots, 19, 20)</math>, a&nbsp;ciąg <math>(| a_k |)</math> to kolejne liczby nieparzyste od <math>1</math> do <math>2 m - 1</math>.
  
:(b)&nbsp;&nbsp;<math>8 k + 1 \,</math> lub <math>\: 8 k + 3</math>
 
  
:(c)&nbsp;&nbsp;<math>6 k + 1</math>
+
Poniżej pokażemy, dlaczego musi być <math>\gcd (Q, m) = 1</math>, gdzie <math>Q</math> jest liczbą wyznaczoną metodą Selfridge'a (o ile sprawdzana jest złożoność liczby <math>m</math> przy testowaniu kolejnych liczb <math>a_k</math>). Pogrubioną czcionką zaznaczone są symbole Jacobiego, które wykryły złożoność liczby <math>m</math>. Gdyby nie była badana złożoność, to wyliczona zostałaby wartość <math>Q</math> na podstawie innego wyrazu ciągu <math>a_k</math> (ten symbol Jacobiego został zapisany zwykłą czcionką).
  
wtedy i&nbsp;tylko wtedy, gdy istnieje dokładnie jedna para liczb całkowitych dodatnich <math>x, y</math>, że
+
::<math>m = 3 , \;\; (5 \mid 3) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1</math>
  
:(a)&nbsp;&nbsp;<math>p = x^2 + y^2</math>
+
::<math>m = 5 , \;\; (5 \mid 5) = 0 , \;\; (- 7 \mid 5) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 \;\;</math> (zauważmy, że <math>(5 \mid 5) = 0</math> nie pozwala wnioskować o&nbsp;złożoności)
  
:(b)&nbsp;&nbsp;<math>p = x^2 + 2 y^2</math>
+
::<math>m = 7 , \;\; (5 \mid 7) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1</math>
  
:(c)&nbsp;&nbsp;<math>p = x^2 + 3 y^2</math>
+
::<math>m = 9 , \;\; </math> (liczba kwadratowa)
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
::<math>m = 11 , \;\; (- 11 \mid 11) = 0 , \;\; (13 \mid 11) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 \;\;</math> (zauważmy, że <math>(- 11 \mid 11) = 0</math> nie pozwala wnioskować o&nbsp;złożoności)
  
<math>\Large{\Longleftarrow}</math>
+
::<math>m = 13 , \;\; (5 \mid 13) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1</math>
  
Niech <math>n = 1, 2, 3</math>. Z&nbsp;założenia liczba pierwsza <math>p \geqslant 3</math> może być przedstawiona w&nbsp;postaci <math>p = x_0^2 + n y_0^2</math>, gdzie <math>x_0, y_0</math> są liczbami takimi, że <math>1 \leqslant x_0, y_0 < p</math>. Zatem <math>p \nmid x_0</math> i <math>p \nmid y_0</math>, a&nbsp;rozpatrując równanie <math>p = x_0^2 + n y_0^2</math> modulo <math>p</math> dostajemy
+
::<math>m = 15 , \;\; \boldsymbol{(5 \mid 15) = 0} , \;\; (13 \mid 15) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 3 \;\;</math> (gdyby nie zbadano złożoności)
  
::<math>x_0^2 + n y_0^2 \equiv 0 \!\! \pmod{p}</math>
+
::<math>m = 17 , \;\; (5 \mid 17) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1</math>
  
Zauważmy, że liczba <math>x_0</math> jest rozwiązaniem kongruencji
+
::<math>m = 19 , \;\; (- 7 \mid 19) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
::<math>x^2 \equiv - n y_0^2 \!\! \pmod{p}</math>
+
::<math>m = 21 , \;\; \boldsymbol{(- 7 \mid 21) = 0} , \;\; (- 11 \mid 21) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 3 \;\;</math> (gdyby nie zbadano złożoności)
  
Wynika stąd, że liczba <math>- n y_0^2</math> jest liczbą kwadratową modulo <math>p</math>. Zatem
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
Niech <math>m \geqslant 23</math>. Wiemy, że w&nbsp;ciągu <math>(5, - 7, 9, \ldots, \pm m, \mp (m + 2), \ldots, - (2 m - 3), 2 m - 1)</math> wystąpią liczby <math>a_k</math> takie, że <math>(a_k \mid m) = - 1</math>. Warunek <math>(a_k \mid m) = 0</math> oznacza, że <math>(2 k + 1 \mid m) = 0</math>, bo
::<math>\left( {\small\frac{- n y_0^2}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{- n}{p}} \right)_{\small{\!\! J}} \cdot \left( {\small\frac{y_0^2}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{- n}{p}} \right)_{\small{\!\! J}} = 1</math>
 
</div>
 
  
Z twierdzenia J38 i&nbsp;zadania J42 otrzymujemy natychmiast
+
::<math>(a_k \mid m) = ((- 1)^k (2 k + 1) \mid m) = ((- 1)^k \mid m) \cdot (2 k + 1 \mid m) = (- 1 \mid m)^k \cdot (2 k + 1 \mid m) = \pm (2 k + 1 \mid m)</math>
  
:(a) jeżeli <math>\left( {\small\frac{- 1}{p}} \right)_{\small{\!\! J}} = 1</math>, to liczba pierwsza <math>p</math> musi być postaci <math>4 k + 1</math>
+
Jeżeli będą spełnione warunki <math>(a_k \mid m) = 0</math> i <math>R_m (a_k) \neq 0</math>, to liczba <math>m</math> będzie liczbą złożoną.
  
:(b) jeżeli <math>\left( {\small\frac{- 2}{p}} \right)_{\small{\!\! J}} = 1</math>, to liczba pierwsza <math>p</math> musi być postaci <math>8 k + 1</math> lub <math>8 k + 3</math>
+
Wypiszmy kolejne próby dla <math>m \geqslant 23</math>. Liczba <math>r</math> jest numerem próby.
  
:(c) jeżeli <math>\left( {\small\frac{- 3}{p}} \right)_{\small{\!\! J}} = 1</math>, to liczba pierwsza <math>p</math> musi być postaci <math>6 k + 1</math>
+
::<math>r = 1 , \;\; a_{r + 1} = 5</math>
  
Co należało pokazać.
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(5 \mid m) = 1</math> || <math>5 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(5 \mid m) = 0</math> || <math>5 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(5 \mid m) = - 1 \quad</math> || <math>5 \nmid m</math> || <math>D = 5 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec'''
 +
|}
  
 +
::<math>r = 2 , \;\; a_{r + 1} = - 7</math>
  
<math>\Large{\Longrightarrow}</math>
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = 1</math> || <math>7 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = 0</math> || <math>7 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = - 1 \quad</math> || <math>7 \nmid m</math> || <math>D = -7 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec'''
 +
|}
  
'''A. Istnienie rozwiązania kongruencji''' <math>\boldsymbol{x^2 + n y^2 \equiv 0 \!\! \pmod{p}}</math>
+
::<math>r = 3</math>, <math>a_{r + 1} = 9</math>
  
Z założenia liczba pierwsza <math>p \geqslant 3</math> jest postaci
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) = 1</math> || <math>3 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) = 0</math> || <math>3 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) \neq - 1 \quad</math> || - - - - || bo <math>9</math> jest liczbą kwadratową
 +
|}
  
:(a)&nbsp;&nbsp;<math>4 k + 1</math>
 
  
:(b)&nbsp;&nbsp;<math>8 k + 1 \,</math> lub <math>\: 8 k + 3</math>
+
Po wykonaniu trzech prób niezakończonych sukcesem (tzn. wykryciem złożoności <math>m</math> lub ustaleniem wartości liczb <math>D</math> i <math>Q</math>) wiemy, że <math>m</math> nie jest podzielna przez żadną z&nbsp;liczb pierwszych <math>p = 3, 5, 7</math>.
  
:(c)&nbsp;&nbsp;<math>6 k + 1</math>
+
::<math>r</math>-ta próba, gdzie <math>r \geqslant 4 , \;\;</math> wyraz <math>a_{r + 1}</math>
  
Wynika stąd, że dla (a) <math>n = 1</math>, (b) <math>n = 2</math>, (c) <math>n = 3</math> mamy
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 1} \mid m) = 1</math> || żadna liczba pierwsza <math>p \leqslant | a_{r + 1} | = 2 r + 3</math> nie dzieli liczby <math>m \quad</math> &nbsp;&nbsp;&nbsp;  || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 1} \mid m) = 0</math> || A. jeżeli <math>m \mid a_{r + 1}</math><sup>( * )</sup><br/>B. jeżeli <math>m \nmid a_{r + 1}</math> || A. przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math> <br/> B. <math>a_{r + 1} \mid m</math><sup>( ** )</sup>, '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 1} \mid m) = - 1 \quad</math> || żadna liczba pierwsza <math>p \leqslant | a_{r + 1} | = 2 r + 3</math> nie dzieli liczby <math>m \quad</math> &nbsp;&nbsp;&nbsp;  || <math>D = a_{r + 1}</math>, <math>Q = {\small\frac{1 - a_{r + 1}}{4}}</math>, '''koniec'''
 +
|}
  
::<math>\left( {\small\frac{- n}{p}} \right)_{\small{\!\! J}} = 1</math>
+
<sup>( * )</sup> jest to możliwe tylko dla <math>a_{r + 1} = a_{(m - 1) / 2} = m</math>
  
(zobacz J38 i&nbsp;J42) i&nbsp;liczba <math>- n</math> jest liczbą kwadratową modulo <math>p</math>. Zatem kongruencja
+
<sup>( ** )</sup> zauważmy, że jeżeli <math>m \nmid a_{r + 1}</math>, to <math>\gcd (a_{r + 1}, m) = | a_{r + 1} |</math>, bo gdyby liczba <math>| a_{r + 1} |</math> była liczbą złożoną, to żaden z&nbsp;jej dzielników pierwszych nie dzieliłby liczby <math>m</math>
  
::<math>x^2 \equiv - n \!\! \pmod{p}</math>
 
  
ma rozwiązanie, czyli istnieje taka liczba <math>k</math>, że
+
Jeżeli nie została wykryta złożoność liczby <math>m</math>, to żadna z&nbsp;liczb pierwszych <math>p \leqslant | a_{r + 1} | = 2 r + 3</math> nie dzieli liczby <math>m</math>. Zatem <math>\gcd (Q, m) > 1</math> może być tylko w&nbsp;przypadku, gdy pewna liczba pierwsza <math>q \geqslant 2 r + 5</math> będzie wspólnym dzielnikiem liczb <math>Q</math> i <math>m</math>, ale jest to niemożliwe, bo
  
::<math>k^2 + n \equiv 0 \!\! \pmod{p}</math>
+
::<math>| Q | = \left| {\small\frac{1 - a_{r + 1}}{4}} \right| \leqslant {\small\frac{| a_{r + 1} | + 1}{4}} = {\small\frac{2 r + 4}{4}} < 2 r + 5 \leqslant q</math>
  
Zauważmy, że liczby <math>x_0 = k</math> i <math>y_0 = 1</math> są szczególnymi przypadkami rozwiązania kongruencji
+
Przedostatnia (ostra) nierówność jest prawdziwa dla wszystkich <math>r</math> naturalnych.<br/>
 +
&#9633;
 +
{{\Spoiler}}
  
::<math>x^2 + n y^2 \equiv 0 \!\! \pmod{p}</math>
 
  
W przypadku (a), korzystając z&nbsp;twierdzenia Wilsona (zobacz J18), liczbę <math>x_0</math> możemy jawnie wypisać: <math>x_0 = \left( {\small\frac{p - 1}{2}} \right) !</math>
 
  
 +
<span style="font-size: 110%; font-weight: bold;">Zadanie M31</span><br/>
 +
Zmodyfikujmy metodę Selfridge'a w&nbsp;taki sposób, że będziemy rozpoczynali próby nie od wyrazu <math>a_2 = 5</math>, ale od wyrazu <math>a_3 = - 7</math>. Pokazać, że w&nbsp;przypadku, gdy dla kolejnych liczb <math>a_k = (- 1)^k (2 k + 1)</math> sprawdzamy, czy konsekwencją <math>(a_k \mid m) = 0</math> jest złożoność liczby <math>m</math>, to dla każdej liczby <math>Q</math> wyznaczonej tak zmodyfikowaną metodą Selfridge'a jest <math>\gcd (Q, m) = 1</math>.
  
'''B. Zmniejszenie rozwiązania początkowego'''
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 +
Poniżej pokażemy, dlaczego musi być <math>\gcd (Q, m) = 1</math>, gdzie <math>Q</math> jest liczbą wyznaczoną zmodyfikowaną metodą Selfridge'a (o ile sprawdzana jest złożoność liczby <math>m</math> przy testowaniu kolejnych liczb <math>a_k</math>). Pogrubioną czcionką zaznaczone są symbole Jacobiego, które wykryły złożoność liczby <math>m</math>. Gdyby nie była badana złożoność, to wyliczona zostałaby wartość <math>Q</math> na podstawie innego wyrazu ciągu <math>a_k</math> (ten symbol Jacobiego został zapisany zwykłą czcionką).
  
Niech liczby <math>x_0, y_0</math> takie, że <math>p \nmid x_0 \,</math> i <math>\, p \nmid y_0</math> spełniają kongruencję
+
::<math>m = 3 , \;\; (- 7 \mid 3) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
::<math>x_0^2 + n y_0^2 \equiv 0 \!\! \pmod{p}</math>
+
::<math>m = 5 , \;\; (- 7 \mid 5) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
Wybierzmy liczby <math>r, s</math> tak, aby były najbliższymi liczbami całkowitymi odpowiednio dla liczb <math>{\small\frac{x_0}{p}} \,</math> i <math>\, {\small\frac{y_0}{p}}</math>. Z&nbsp;definicji mamy
+
::<math>m = 7 , \;\; (- 7 \mid 7) = 0 , \;\; (- 11 \mid 7) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 1</math> (zauważmy, że <math>(- 7 \mid 7) = 0</math> nie pozwala wnioskować o&nbsp;złożoności)
  
::<math>\left| {\small\frac{x_0}{p}} - r \right| \leqslant {\small\frac{1}{2}} \qquad \qquad \text{i} \qquad \qquad \left| {\small\frac{y_0}{p}} - s \right| \leqslant {\small\frac{1}{2}}</math>
+
::<math>m = 9 , \;\; </math> (liczba kwadratowa)
  
Zatem
+
::<math>m = 11 , \;\; (- 11 \mid 11) = 0 , \;\; (13 \mid 11) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 \;\;</math> (zauważmy, że <math>(- 11 \mid 11) = 0</math> nie pozwala wnioskować o&nbsp;złożoności)
  
::<math>| x_0 - r p | \leqslant {\small\frac{p}{2}} \qquad \qquad \text{i} \qquad \qquad | y_0 - s p | \leqslant {\small\frac{p}{2}}</math>
+
::<math>m = 13 , \;\; (- 7 \mid 13) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
Ponieważ liczby po lewej stronie nierówności są liczbami całkowitymi, to nigdy nie będą równe liczbie <math>{\small\frac{p}{2}}</math>, gdzie <math>p</math> jest liczbą nieparzystą. Pozwala to wzmocnić wypisane nierówności.
+
::<math>m = 15 , \;\; \boldsymbol{(9 \mid 15) = 0} , \;\; (13 \mid 15) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 3 \;\;</math> (gdyby nie zbadano złożoności)
  
::<math>| x_0 - r p | < {\small\frac{p}{2}} \qquad \qquad \text{i} \qquad \qquad | y_0 - s p | < {\small\frac{p}{2}}</math>
+
::<math>m = 17 , \;\; (- 7 \mid 17) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
Wynika stąd, że dla dowolnego rozwiązania początkowego <math>x_0, y_0</math> możemy wybrać liczby
+
::<math>m = 19 , \;\; (- 7 \mid 19) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1</math>
  
::<math>x = x_0 - r p \qquad \qquad \text{i} \qquad \qquad y = y_0 - s p</math>
+
::<math>m = 21 , \;\; \boldsymbol{(- 7 \mid 21) = 0} , \;\; (- 11 \mid 21) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 3 \;\;</math> (gdyby nie zbadano złożoności)
  
takie, że <math>p \nmid x</math> oraz <math>p \nmid y</math> i&nbsp;dla których
 
  
::<math>0 < x^2 + n y^2 < \left( {\small\frac{p}{2}} \right)^2 + n \left( {\small\frac{p}{2}} \right)^2 = {\small\frac{(n + 1) p}{4}} \cdot p</math>
+
Niech <math>m \geqslant 23</math>. Wiemy, że w&nbsp;ciągu <math>( - 7, 9, \ldots, \pm m, \mp (m + 2), \ldots, - (2 m - 3), 2 m - 1)</math> wystąpią liczby <math>a_k</math> takie, że <math>(a_k \mid m) = - 1</math>. Warunek <math>(a_k \mid m) = 0</math> oznacza, że <math>(2 k + 1 \mid m) = 0</math>, bo
  
Ponieważ modulo <math>p</math> jest <math>x \equiv x_0 \,</math> i <math>\, y \equiv y_0</math>, to liczby <math>x, y</math> spełniają kongruencję
+
::<math>(a_k \mid m) = ((- 1)^k (2 k + 1) \mid m) = ((- 1)^k \mid m) \cdot (2 k + 1 \mid m) = (- 1 \mid m)^k \cdot (2 k + 1 \mid m) = \pm (2 k + 1 \mid m)</math>
  
::<math>x^2 + n y^2 \equiv 0 \!\! \pmod{p}</math>
+
Jeżeli będą spełnione warunki <math>(a_k \mid m) = 0</math> i <math>R_m (a_k) \neq 0</math>, to liczba <math>m</math> będzie liczbą złożoną.
  
Zatem wynikające z&nbsp;powyższej kongruencji równanie
+
Wypiszmy kolejne próby dla <math>m \geqslant 23</math>. Liczba <math>r</math> jest numerem próby.
  
::<math>x^2 + n y^2 = m p</math>
+
::<math>r = 1 , \;\; a_{r + 2} = - 7</math>
  
ma rozwiązanie dla liczb
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = 1</math> || <math>7 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = 0</math> || <math>7 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 7 \mid m) = - 1 \quad</math> || <math>7 \nmid m</math> || <math>D = - 7 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec'''
 +
|}
  
::<math>| x | < {\small\frac{p}{2}} , \qquad \qquad | y | < {\small\frac{p}{2}}, \qquad \qquad 1 \leqslant m < {\small\frac{(n + 1) p}{4}}</math>
+
::<math>r = 2 , \;\; a_{r + 2} = 9</math>
  
Pomysł ze zmniejszaniem liczb stanowiących rozwiązanie za chwilę wykorzystamy ponownie i&nbsp;będzie to istotny element dowodu.
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) = 1</math> || <math>3 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) = 0</math> || <math>3 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(9 \mid m) \neq - 1 \quad</math> || - - - - || bo <math>9</math> jest liczbą kwadratową
 +
|}
  
 +
::<math>r = 3 , \;\; a_{r + 2} = - 11</math>
  
'''C. Metoda nieskończonego schodzenia Fermata'''<ref name="InfiniteDescent1"/><ref name="Bussey1"/>
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 11 \mid m) = 1</math> || <math>11 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 11 \mid m) = 0</math> || <math>11 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 11 \mid m) = - 1 \quad</math> || <math>11 \nmid m</math> || <math>D = - 11 , \;\; Q = 3 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec''' (bo liczby złożone <math>m = 3 k</math> zostały usunięte w&nbsp;poprzedniej próbie, <math>r = 2</math>)
 +
|}
  
Pomysł dowodu został zaczerpnięty z&nbsp;książki Hardy'ego i&nbsp;Wrighta<ref name="HardyWright1"/>.
+
::<math>r = 4 , \;\; a_{r + 2} = 13</math>
  
Jeżeli w&nbsp;rozwiązaniu <math>m = 1</math>, to <math>p = x^2 + n y^2</math> i&nbsp;twierdzenie jest udowodnione. W&nbsp;przypadku gdy <math>m > 1</math> wskażemy sposób postępowania, który pozwoli nam z&nbsp;istniejącego rozwiązania równania
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(13 \mid m) = 1</math> || <math>13 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(13 \mid m) = 0</math> || <math>13 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(13 \mid m) = - 1 \quad</math> || <math>13 \nmid m</math> || <math>D = 13 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec''' (bo liczby złożone <math>m = 3 k</math> zostały usunięte w&nbsp;próbie o&nbsp;numerze <math>r = 2</math>)
 +
|}
  
::<math>x^2 + n y^2 = m p</math>
+
::<math>r = 5 , \;\; a_{r + 2} = - 15</math>
  
otrzymać nowe rozwiązanie tej samej postaci
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 15 \mid m) = 1</math> || <math>5 \nmid m \quad</math> || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 15 \mid m) = 0</math> || <math>5 \mid m</math> || '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(- 15 \mid m) = - 1 \quad</math> || <math>5 \nmid m</math> || <math>D = - 15 , \;\; Q = 4 , \;\; \gcd (m, Q) = 1 , \;\;</math> '''koniec'''
 +
|}
  
::<math>x_1^2 + n y_1^2 = m_1 p</math>
 
  
takie, że <math>1 \leqslant m_1 < m</math>. Powtarzając tę procedurę odpowiednią ilość razy, otrzymamy rozwiązanie <math>x_k, y_k, m_k</math>, gdzie <math>m_k = 1</math>. Istnienie takiej procedury stanowi dowód prawdziwości twierdzenia.
+
Po wykonaniu pięciu prób niezakończonych sukcesem (tzn. wykryciem złożoności <math>m</math> lub ustaleniem wartości liczb <math>D</math> i <math>Q</math>) wiemy, że <math>m</math> nie jest podzielna przez żadną z&nbsp;liczb pierwszych <math>p = 3, 5, 7, 11, 13</math>.
  
Zauważmy, że podział na parzyste i&nbsp;nieparzyste liczby <math>m</math> jest konieczny tylko w&nbsp;przypadku gdy <math>n = 3</math>. W&nbsp;pozostałych przypadkach nie musimy wzmacniać nierówności, aby prawdziwe było oszacowanie <math>1 \leqslant m_1 < m</math>.
+
::<math>r</math>-ta próba, gdzie <math>r \geqslant 6 , \;\;</math> wyraz <math>a_{r + 2}</math>
  
'''Przypadek, gdy''' <math>\boldsymbol{m > 1}</math> '''jest liczbą parzystą'''
+
::{| border="0"
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 2} \mid m) = 1</math> || żadna liczba pierwsza <math>p \leqslant | a_{r + 2} | = 2 r + 5</math> nie dzieli liczby <math>m \quad</math> &nbsp;&nbsp;&nbsp;  || przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math>
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 2} \mid m) = 0</math> || A. jeżeli <math>m \mid a_{r + 2}</math><sup>( * )</sup><br/>B. jeżeli <math>m \nmid a_{r + 2}</math> || A. przechodzimy do kolejnego wyrazu ciągu <math>(a_k)</math> <br/> B. <math>a_{r + 1} \mid m</math><sup>( ** )</sup>, '''koniec'''
 +
|-style=height:2em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>(a_{r + 2} \mid m) = - 1 \quad</math> || żadna liczba pierwsza <math>p \leqslant | a_{r + 2} | = 2 r + 5</math> nie dzieli liczby <math>m \quad</math> &nbsp;&nbsp;&nbsp;  || <math>D = a_{r + 2}</math>, <math>Q = {\small\frac{1 - a_{r + 2}}{4}}</math>, '''koniec'''
 +
|}
  
Jeżeli <math>m > 1</math> jest liczbą parzystą, to z&nbsp;twierdzenia K61 wiemy, że liczba <math>x^2 + n y^2</math> może być zapisana w&nbsp;postaci
+
<sup>( * )</sup> jest to możliwe tylko dla <math>a_{r + 2} = a_{(m - 1) / 2} = m</math>
  
::<math>x^2 + n y^2 = 2^{\alpha} (x^2_1 + n y^2_1)</math>
+
<sup>( ** )</sup> zauważmy, że jeżeli <math>m \nmid a_{r + 2}</math>, to <math>\gcd (a_{r + 2}, m) = | a_{r + 2} |</math>, bo gdyby liczba <math>| a_{r + 2} |</math> była liczbą złożoną, to żaden z&nbsp;jej dzielników pierwszych nie dzieliłby liczby <math>m</math>
  
gdzie <math>x^2_1 + n y^2_1</math> jest liczbą nieparzystą. Wystarczy położyć <math>m_1 = {\small\frac{m}{2^{\alpha}}}</math>, aby z&nbsp;istniejącego rozwiązania otrzymać nowe rozwiązanie tej samej postaci
 
  
::<math>x_1^2 + n y_1^2 = m_1 p</math>
+
Jeżeli nie została wykryta złożoność liczby <math>m</math>, to żadna z&nbsp;liczb pierwszych <math>p \leqslant | a_{r + 2} | = 2 r + 5</math> nie dzieli liczby <math>m</math>. Zatem <math>\gcd (Q, m) > 1</math> może być tylko w&nbsp;przypadku, gdy pewna liczba pierwsza <math>q \geqslant 2 r + 7</math> będzie wspólnym dzielnikiem liczb <math>Q</math> i <math>m</math>, ale jest to niemożliwe, bo
  
gdzie <math>m_1</math> jest liczbą nieparzystą i <math>1 \leqslant m_1 < m</math>.
+
::<math>| Q | = \left| {\small\frac{1 - a_{r + 2}}{4}} \right| \leqslant {\small\frac{| a_{r + 2} | + 1}{4}} = {\small\frac{2 r + 6}{4}} < 2 r + 7 \leqslant q</math>
  
'''Przypadek, gdy''' <math>\boldsymbol{m > 1}</math> '''jest liczbą nieparzystą'''
+
Przedostatnia (ostra) nierówność jest prawdziwa dla wszystkich <math>r</math> naturalnych.<br/>
 +
&#9633;
 +
{{\Spoiler}}
  
Niech liczby <math>r, s</math> będą liczbami całkowitymi najbliższymi liczbom <math>{\small\frac{x}{m}} \,</math> i <math>\, {\small\frac{y}{m}}</math>. Z&nbsp;definicji mamy
 
  
::<math>\left| {\small\frac{x}{m}} - r \right| \leqslant {\small\frac{1}{2}} \qquad \qquad \text{i} \qquad \qquad \left| {\small\frac{y}{m}} - s \right| \leqslant {\small\frac{1}{2}}</math>
 
  
Zatem
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M32</span><br/>
 +
Przyjmując metodę Selfridge'a wyboru parametrów <math>P, Q</math> dla testu Lucasa, możemy łatwo napisać odpowiedni program w&nbsp;PARI/GP testujący pierwszość liczb
  
::<math>| x - r m | \leqslant {\small\frac{m}{2}} \qquad \qquad \text{i} \qquad \qquad | y - s m | \leqslant {\small\frac{m}{2}}</math>
+
<span style="font-size: 90%; color:black;">LucasTest(m) =
 +
{
 +
'''local'''(P, Q, X);
 +
'''if'''( m % 2 == 0, '''return'''(m == 2) );
 +
'''if'''( '''issquare'''(m), '''return'''(0) ); \\ sprawdzamy, czy m nie jest liczbą kwadratową
 +
X = MethodA(m);
 +
P = X[1];
 +
Q = X[2];
 +
'''if'''( P == 0, '''return'''(0) ); \\ jeżeli P = 0, to m jest liczbą złożoną
 +
'''if'''( modLucas(m + 1, P, Q, m)[1] == 0, '''return'''(1), '''return'''(0) );
 +
}</span>
  
Ponieważ liczby po lewej stronie nierówności są liczbami całkowitymi, to nigdy nie będą równe liczbie <math>{\small\frac{m}{2}}</math>, gdzie <math>m</math> jest liczbą nieparzystą. Pozwala to wzmocnić wypisane nierówności.
 
  
::<math>| x - r m | < {\small\frac{m}{2}} \qquad \qquad \text{i} \qquad \qquad | y - s m | < {\small\frac{m}{2}}</math>
 
  
Połóżmy
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M33</span><br/>
 +
Najmniejsze liczby pseudopierwsze Lucasa, które pojawiają się przy zastosowaniu metody Selfridge'a wyboru parametrów <math>P</math> i <math>Q</math>, to
  
::<math>a = x - r m \qquad \qquad \text{i} \qquad \qquad b = y - s m</math>
+
::<math>323, 377, 1159, 1829, 3827, 5459, 5777, 9071, 9179, 10877, 11419, 11663, 13919, 14839, 16109, 16211, 18407, 18971, 19043, 22499, \ldots</math>
  
Zauważmy, że liczba <math>m</math> nie może jednocześnie dzielić liczb <math>x</math> i <math>y</math>, bo mielibyśmy <math>m^2 \mid (x^2 + n y^2)</math>, czyli <math>m \mid p</math>, co jest niemożliwe. Zatem przynajmniej jedna z&nbsp;liczb <math>a, b</math> musi być różna od <math>0</math>.
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 +
<span style="font-size: 90%; color:black;">'''forstep'''(k=1, 3*10^4, 2, '''if'''( LucasTest(k) && !'''isprime'''(k), '''print'''(k)) )</span>
 +
<br/>
 +
{{\Spoiler}}
  
Rozpatrując równanie <math>x^2 + n y^2 = m p</math> modulo <math>m</math> i&nbsp;uwzględniając, że
 
  
::<math>x \equiv a \!\! \pmod{m}</math>
 
  
::<math>y \equiv b \!\! \pmod{m}</math>
+
Tabela przedstawia ilość takich liczb nie większych od <math>10^n</math>
  
otrzymujemy
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 
+
! <math>\boldsymbol{n}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math>
::<math>a^2 + n b^2 \equiv 0 \pmod{m}</math>
+
|-
 
+
| #LPSP <math>< 10^n</math> (metoda Selfridge'a) || <math>2</math> || <math>9</math> || <math>57</math> || <math>219</math> || <math>659</math> || <math>1911</math> || <math>5485</math>
Mamy też oszacowanie
+
|}
 
 
::<math>0 < a^2 + n b^2 < \left( {\small\frac{m}{2}} \right)^2 + n \cdot \left( {\small\frac{m}{2}} \right)^2 = {\small\frac{(n + 1) m^2}{4}} = {\small\frac{(n + 1) m}{4}} \cdot m</math>
 
 
 
Wynika stąd, że istnieje taka liczba <math>m_1</math> spełniająca warunek <math>1 \leqslant m_1 < {\small\frac{(n + 1) m}{4}}</math>, że
 
 
 
::<math>a^2 + n b^2 = m_1 m</math>
 
 
 
Mnożąc stronami powyższe równanie i&nbsp;równanie <math>x^2 + n y^2 = m p</math>, otrzymujemy
 
 
 
::<math>m_1 m^2 p = (a^2 + n b^2) (x^2 + n y^2)</math>
 
 
 
::::<math>\;\; = (a x + n b y)^2 + n (a y - b x)^2</math>
 
 
 
(zobacz K60). Zauważmy teraz, że
 
 
 
::<math>a x + n b y = (x - r m) x + n (y - s m) y</math>
 
 
 
::::<math>\quad \; = x^2 - r m x + n y^2 - n s m y</math>
 
 
 
::::<math>\quad \; = m (p - r x - n s y)</math>
 
 
 
::::<math>\quad \; = m x_1</math>
 
 
 
 
 
::<math>a y - b x = (x - r m) y - (y - s m) x</math>
 
 
 
::::<math>\;\;\, = x y - r m y - y x + s m x</math>
 
 
 
::::<math>\;\;\, = m (s x - r y)</math>
 
 
 
::::<math>\;\;\, = m y_1</math>
 
 
 
Gdzie oznaczyliśmy
 
 
 
::<math>x_1 = p - r x - n s y</math>
 
 
 
::<math>y_1 = s x - r y</math>
 
 
 
Wynika stąd, że
 
 
 
::<math>m_1 m^2 p = (m x_1)^2 + n (m y_1)^2</math>
 
 
 
Zatem
 
 
 
::<math>x^2_1 + n y^2_1 = m_1 p</math>
 
 
 
gdzie
 
 
 
::<math>1 \leqslant m_1 < {\small\frac{(n + 1) m}{4}}</math>
 
 
 
Czyli powtarzając odpowiednią ilość razy opisaną powyżej procedurę, otrzymamy <math>m_k = 1</math>.
 
 
 
 
 
'''D. Jednoznaczność rozkładu'''
 
 
 
Z założenia <math>p</math> jest liczbą pierwszą, zatem jednoznaczność rozkładu wynika z&nbsp;twierdzenia K59. Co kończy dowód.<br/>
 
&#9633;
 
{{\Spoiler}}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Uwaga K63</span><br/>
 
Udowodnione wyżej twierdzenie można wykorzystać do znalezienia rozkładu liczby pierwszej <math>p</math> postaci <math>4 k + 1</math> na sumę dwóch kwadratów. Dla dużych liczb pierwszych funkcja działa wolno, bo dużo czasu zajmuje obliczanie silni.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
  <span style="font-size: 90%; color:black;">SumOfTwoSquares(p) =
+
  <span style="font-size: 90%; color:black;">'''for'''(n=3, 9, s=0; '''forstep'''(k = 1, 10^n, 2, '''if'''( LucasTest(k) && !'''isprime'''(k), s++ ) ); '''print'''("n= ", n, "  ", s) )</span>
{
+
<br/>
'''local'''(m, r, s, x, y, x1, y1);
 
'''if'''( p%4 <> 1 || !'''isprime'''(p), '''return'''("Error") );
 
x = 1;
 
'''for'''(k = 2, (p-1)/2, x = (x*k)%p); \\ x = { [(p-1)/2]! } % p
 
x = x - '''round'''(x/p)*p;
 
y = 1;
 
m = (x^2 + y^2)/p;
 
'''while'''( m > 1,
 
        r = '''round'''(x/m);
 
        s = '''round'''(y/m);
 
        x1 = p - r*x - s*y;
 
        y1 = r*y - s*x;
 
        x = x1;
 
        y = y1;
 
        m = (x^2 + y^2)/p;
 
      );
 
'''return'''([ '''abs'''(x), '''abs'''(y), p ]);
 
}</span>
 
 
{{\Spoiler}}
 
{{\Spoiler}}
  
  
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K64</span><br/>
 
Niech liczby pierwsze <math>p, q</math> będą postaci <math>4 k + 1</math>, a&nbsp;liczba pierwsza <math>r</math>
 
będzie postaci <math>4 k + 3</math>. Pokazać, że
 
:*&nbsp;&nbsp;liczby <math>r, p r \,</math> i <math>\, r^2</math> nie rozkładają się na sumę dwóch kwadratów liczb całkowitych dodatnich
 
:*&nbsp;&nbsp;liczby <math>p</math>, <math>2 p</math>, <math>p^2 \,</math> i <math>\, p r^2</math> mają jeden rozkład na sumę dwóch kwadratów liczb całkowitych dodatnich
 
:*&nbsp;&nbsp;liczba <math>p q</math>, <math>p \neq q</math> ma dwa rozkłady na sumę dwóch kwadratów liczb całkowitych dodatnich
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 
  
'''Punkt 1.'''
+
== Liczby silnie pseudopierwsze Lucasa ==
  
Ponieważ liczby <math>r \,</math> i <math>\, p r</math> są postaci <math>4 k + 3</math>, to modulo <math>4</math> mamy
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M34</span><br/>
 +
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą taką, że <math>\gcd (p, Q D) = 1</math> oraz <math>p - (D \mid p) = 2^r w</math>, gdzie <math>w</math> jest liczbą nieparzystą, to spełniony jest dokładnie jeden z&nbsp;warunków
  
::<math>r, p r \equiv 3 \!\! \pmod{4}</math>
+
::<math>U_w \equiv 0 \pmod{p}</math>
  
Suma <math>x^2 + y^2</math> musi być liczbą nieparzystą, zatem liczby <math>x, y</math> muszą mieć przeciwną parzystość i&nbsp;modulo <math>4</math> mamy
+
lub
  
::<math>x^2 + y^2 \equiv 1 \!\! \pmod{4}</math>
+
::<math>V_{2^k w} \equiv 0 \pmod{p} \qquad</math> dla pewnego <math>k \in [0, r - 1]</math>
  
Przypuśćmy, że
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 +
Wiemy (zobacz M20), że jeżeli <math>p</math> jest liczbą pierwszą nieparzystą taką, że <math>\gcd (p, Q D) = 1</math>, to <math>p \mid U_{p - (D \mid p)}</math>. Z&nbsp;założenia jest <math>p - (D \mid p) = 2^r w</math>, zatem <math>p \mid U_{2^r w}</math>. Ponieważ założyliśmy, że <math>p \nmid Q</math> i <math>p \nmid D</math>, to ze wzoru <math>V^2_n - D U^2_n = 4 Q^n</math> (zobacz M13 p.14) wynika natychmiast, że <math>p</math> nie może dzielić jednocześnie liczb <math>U_n</math> i <math>V_n</math>.
  
::<math>r^2 = x^2 + y^2</math>
+
Korzystając ze wzoru <math>U_{2 n} = U_n V_n</math> (zobacz M13 p.11), otrzymujemy
  
gdzie <math>x, y \in \mathbb{Z}_+</math>. Liczby <math>x, y</math> muszą mieć przeciwną parzystość, zatem <math>x \neq y</math>. Z&nbsp;twierdzenia J22 wynika, że liczba <math>x^2 + y^2</math> musi mieć dzielnik pierwszy postaci <math>4 k + 1</math>, co w&nbsp;sposób oczywisty jest niemożliwe.
+
::{| border="0"
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>p \mid U_{2^r w} \;\; \Longleftrightarrow \;\; p \mid U_{2^{r - 1} w} \cdot V_{2^{r - 1} w} \quad</math> || Jeżeli <math>p \mid V_{2^{r - 1} w}</math>, to twierdzenie jest dowiedzione. Jeżeli <math>p \nmid V_{2^{r - 1} w}</math>, to <math>p \mid U_{2^{r - 1} w}</math>.
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>p \mid U_{2^{r - 1} w} \;\; \Longleftrightarrow \;\; p \mid U_{2^{r - 2} w} \cdot V_{2^{r - 2} w} \quad</math> || Jeżeli <math>p \mid V_{2^{r - 2} w}</math>, to twierdzenie jest dowiedzione. Jeżeli <math>p \nmid V_{2^{r - 2} w}</math>, to <math>p \mid U_{2^{r - 2} w}</math>.
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>.................</math> ||
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>p \mid U_{4 w} \;\; \Longleftrightarrow \;\; p \mid U_{2 w} \cdot V_{2 w}</math> || Jeżeli <math>p \mid V_{2 w}</math>, to twierdzenie jest dowiedzione. Jeżeli <math>p \nmid V_{2 w}</math>, to <math>p \mid U_{2 w}</math>.
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>p \mid U_{2 w} \;\; \Longleftrightarrow \;\; p \mid U_w \cdot V_w</math> || Jeżeli <math>p \mid V_w</math>, to twierdzenie jest dowiedzione. Jeżeli <math>p \nmid V_w</math>, to <math>p \mid U_w</math>.
 +
|}
  
'''Punkt 2.'''
+
Z powyższego wynika, że musi być spełniony jeden z wypisanych w twierdzeniu warunków.
  
W przypadku liczby pierwszej <math>p</math> odpowiedzi udziela twierdzenie K62. Niech <math>p = x^2 + y^2</math>, mamy
 
  
::<math>2 p = (x + y)^2 + (x - y)^2</math>
+
Zauważmy teraz, że jeżeli liczba pierwsza <math>p</math> dzieli <math>V_w</math>, to <math>p \nmid U_w</math>, bo <math>p</math> nie może jednocześnie być dzielnikiem liczb <math>U_w</math> i <math>V_w</math>.
  
::<math>p^2 = (x^2 - y^2)^2 + (2 x y)^2</math>
+
Zauważmy też, że jeżeli dla pewnego <math>k \in [1, r - 1]</math> liczba pierwsza <math>p</math> dzieli <math>V_{2^k w}</math>, to <math>p</math> nie dzieli żadnej liczby <math>V_{2^j w}</math> dla <math>j \in [0, k - 1] \;\; \text{i} \;\; p \nmid U_w</math>. Istotnie:
  
::<math>p r^2 = (r x)^2 + (r y)^2</math>
+
::{| border="0"
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || jeżeli <math>p \mid V_{2^k w}</math>, to <math>p \nmid U_{2^k w} \;\; \text{i} \;\; U_{2^k w} = U_{2^{k - 1} w} V_{2^{k - 1} w}</math>, zatem <math>p</math> nie może być dzielnikiem żadnej z liczb <math>U_{2^{k - 1} w} \;\; \text{i} \;\; V_{2^{k - 1} w}</math>
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || jeżeli <math>p \nmid U_{2^{k - 1} w} \;\; \text{i} \;\; U_{2^{k - 1} w} = U_{2^{k - 2} w} V_{2^{k - 2} w}</math>, to <math>p</math> nie może być dzielnikiem żadnej z liczb <math>U_{2^{k - 2} w} \;\; \text{i} \;\; V_{2^{k - 2} w}</math>
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || <math>.................</math> ||
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || jeżeli <math>p \nmid U_{4 w} \;\; \text{i} \;\; U_{4 w} = U_{2 w} V_{2 w}</math>, to <math>p</math> nie może być dzielnikiem żadnej z liczb <math>U_{2 w} \;\; \text{i} \;\; V_{2 w}</math>
 +
|-style=height:3em
 +
| &#9679;&nbsp;&nbsp;&nbsp; || jeżeli <math>p \nmid U_{2 w} \;\; \text{i} \;\; U_{2 w} = U_w V_w</math>, to <math>p</math> nie może być dzielnikiem żadnej z liczb <math>U_w \;\; \text{i} \;\; V_w</math>
 +
|}
  
'''Punkt 3.'''
 
  
Niech <math>p = x^2 + y^2</math> i <math>q = a^2 + b^2</math>. Ze wzorów podanych w&nbsp;uwadze K60 mamy
+
Co dowodzi, że spełniony jest dokładnie jeden z <math>r + 1</math> warunków:
  
::<math>p q = (a^2 + b^2) (x^2 + y^2) = (a x + b y)^2 + (a y - b x)^2</math>
+
::<math>U_w \equiv 0 \pmod{p}</math>
  
:::::::::<math>\:\, = (a x - b y)^2 + (a y + b x)^2</math>
+
::<math>V_{2^k w} \equiv 0 \pmod{p} \qquad</math> gdzie <math>k \in [0, r - 1]</math>
  
 
Co należało pokazać.<br/>
 
Co należało pokazać.<br/>
Linia 2333: Linia 1598:
  
  
 +
Konsekwentnie definiujemy liczby pseudopierwsze<br/>
 +
<span style="font-size: 110%; font-weight: bold;">Definicja M35</span><br/>
 +
Powiemy, że liczba złożona nieparzysta <math>m</math> jest liczbą silnie pseudopierwszą Lucasa (SLPSP) dla parametrów <math>P</math> i <math>Q</math>, jeżeli <math>\gcd (m, Q D) = 1</math> oraz <math>m - (D \mid m) = 2^r w</math>, gdzie <math>w</math> jest liczbą nieparzystą i&nbsp;spełniony jest jeden z&nbsp;warunków
  
 +
::<math>U_w \equiv 0 \pmod{m}</math>
  
== Twierdzenia o&nbsp;istnieniu liczb pierwszych kwadratowych i&nbsp;niekwadratowych modulo ==
+
lub
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K65</span><br/>
+
::<math>V_{2^k w} \equiv 0 \pmod{m} \;</math> dla pewnego <math>k \in [0, r - 1]</math>
Niech <math>s = \pm 1</math>. Zbadać podzielność liczby <math>p - s a^2</math>
 
  
:* przez <math>4</math>, gdy <math>p = 4 k + r</math>, gdzie <math>r = 1, 3</math>
 
:* przez <math>8</math>, gdy <math>p = 8 k + r</math>, gdzie <math>r = 1, 3, 5, 7</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
 
Problem sprowadza się do uzyskania odpowiedzi, kiedy kongruencja
 
  
::<math>p - s a^2 \equiv 0 \pmod{2^n}</math>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M36</span><br/>
 +
Każda liczba SLPSP(<math>P, Q</math>) jest LPSP(<math>P, Q</math>). Korzystając ze zdefiniowanych wcześniej funkcji: <code>modPower(a, n, m)</code>, <code>jacobi(a, n)</code> i <code>modLucas(n, P, Q, m)</code> (zobacz L2, J44, M15), możemy napisać prosty program, który sprawdza, czy liczba <math>m</math> spełnia jeden z&nbsp;warunków podanych w&nbsp;twierdzeniu M34.
  
gdzie <math>n = 2, 3</math>, ma rozwiązanie. Podstawiając, dostajemy
+
<span style="font-size: 90%; color: black;">isPrimeOr<span style="background-color: #fee481;">SLPSP</span>(m, P, Q) =  
 +
{
 +
'''local'''(a, b, c, D, js, k, r, w, X);
 +
D = P^2 - 4*Q;
 +
'''if'''( gcd(m, 2*Q*D) > 1, '''return'''(0) );
 +
js = jacobi(D, m);
 +
r = '''valuation'''(m - js, 2); \\ znajdujemy wykładnik, z jakim liczba 2 występuje w m - js
 +
w = (m - js) / 2^r;
 +
X =  modLucas(w, P, Q, m);
 +
a = X[1]; \\ U_w(P, Q) % m
 +
b = X[2]; \\ V_w(P, Q) % m
 +
'''if'''( a == 0 || b == 0, '''return'''(1) ); \\ b == 0 to przypadek k == 0
 +
'''if'''( r == 1, '''return'''(0) ); \\ nie ma dalszych przypadków
 +
c = modPower(Q, w, m); \\ Q^w % m
 +
k = 0;
 +
\\ sprawdzamy warunek V_(2^k * w) % m = 0; korzystamy ze wzoru V_(2*t) = (V_t)^2 - 2*Q^t
 +
'''while'''( k++ < r,
 +
        b = (b^2 - 2*c) % m;
 +
        '''if'''( b == 0, '''return'''(1) );
 +
        c = c^2 % m;
 +
      );
 +
'''return'''(0);
 +
}</span>
  
::<math>2^n k + r \equiv s a^2 \pmod{2^n}</math>
 
  
::<math>s a^2 \equiv r \pmod{2^n}</math>
 
  
::<math>a^2 \equiv s r \pmod{2^n}</math>
+
<span style="font-size: 110%; font-weight: bold;">Przykład M37</span><br/>
 +
Poniższa tabela zawiera najmniejsze liczby silnie pseudopierwsze Lucasa dla różnych parametrów <math>P</math> i <math>Q</math>
  
Z twierdzenia J51 wiemy, że aby powyższa kongruencja miała rozwiązanie, musi być <math>2^n \mid (s r - 1)</math>, co jest możliwe tylko, gdy
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 +
! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<math>\boldsymbol{P}</math><br/><math>\boldsymbol{Q}</math>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 +
! <math>\boldsymbol{1}</math> !! <math>\boldsymbol{2}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math> !! <math>\boldsymbol{10}</math>
 +
|-
 +
! <math>\boldsymbol{- 5}</math>
 +
| <math>253</math> || <math>121</math> || style="background-color: yellow" | <math>143</math> || <math>781</math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>299</math> || <math>121</math> || style="background-color: yellow" | <math>407</math> || <math>9</math> || style="background-color: yellow" | <math>143</math>
 +
|-
 +
! <math>\boldsymbol{- 4}</math>
 +
| <math>9</math> || <math>4181</math> || <math>341</math> || <math>169</math> || <math>33</math> || style="background-color: yellow" | <math>119</math> || <math>57</math> || <math>9</math> || <math>9</math> || <math>9</math>
 +
|-
 +
! <math>\boldsymbol{- 3}</math>
 +
| style="background-color: yellow" | <math>799</math> || <math>121</math> || style="background-color: yellow" | <math>527</math> || <math>25</math> || <math>85</math> || style="background-color: yellow" | <math>209</math> || style="background-color: yellow" | <math>55</math> || style="background-color: yellow" | <math>35</math> || <math>169</math> || <math>529</math>
 +
|-
 +
! <math>\boldsymbol{- 2}</math>
 +
| <math>2047</math> || style="background-color: yellow" | <math>989</math> || <math>161</math> || <math>49</math> || <math>49</math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>35</math> || <math>9</math> || <math>265</math>
 +
|-
 +
! <math>\boldsymbol{- 1}</math>
 +
| <math>4181</math> || <math>169</math> || style="background-color: yellow" | <math>119</math> || <math>9</math> || <math>9</math> || style="background-color: yellow" | <math>629</math> || <math>25</math> || <math>33</math> || <math>9</math> || style="background-color: yellow" | <math>51</math>
 +
|-
 +
! <math>\boldsymbol{1}</math>
 +
| <math>25</math> || style="background-color: red" | <math></math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>209</math> || style="background-color: yellow" | <math>527</math> || style="background-color: yellow" | <math>35</math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>559</math> || <math>9</math> || <math>49</math>
 +
|-
 +
! <math>\boldsymbol{2}</math>
 +
| style="background-color: yellow" | <math>5459</math> || <math>9</math> || <math>2047</math> || <math>169</math> || <math>21</math> || <math>253</math> || <math>9</math> || style="background-color: yellow" | <math>15</math> || <math>9</math> || <math>49</math>
 +
|-
 +
! <math>\boldsymbol{3}</math>
 +
| style="background-color: yellow" | <math>899</math> || style="background-color: yellow" | <math>5983</math> || <math>25</math> || <math>121</math> || <math>49</math> || <math>49</math> || style="background-color: yellow" | <math>35</math> || <math>55</math> || <math>25</math> || style="background-color: yellow" | <math>35</math>
 +
|-
 +
! <math>\boldsymbol{4}</math>
 +
| style="background-color: yellow" | <math>899</math> || <math>25</math> || <math>1541</math> || style="background-color: red" | <math></math> || <math>341</math> || style="background-color: yellow" | <math>323</math> || style="background-color: yellow" | <math>377</math> || style="background-color: yellow" | <math>209</math> || <math>9</math> || style="background-color: yellow" | <math>527</math>
 +
|-
 +
! <math>\boldsymbol{5}</math>
 +
| <math>9</math> || style="background-color: yellow" | <math>527</math> || <math>49</math> || style="background-color: yellow" | <math>527</math> || <math>4181</math> || <math>781</math> || style="background-color: yellow" | <math>39</math> || <math>9</math> || <math>9</math> || <math>9</math>  
 +
|}
  
::<math>s =  
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
\begin{cases}
+
<span style="font-size: 90%; color:black;">FirstSLPSP(Stop) =  
  \;\;\: 1 & \text{gdy } r = 1 \\
+
  \\ najmniejsze SLPSP(P,Q) < Stop; dla 1<=P<=10 i -5<=Q<=5
      - 1 & \text{gdy } r = 3 \\
+
{
\end{cases}</math>
+
'''local'''(D, m, P, Q);
 
+
Q = -6;
dla <math>2^n = 4</math> i&nbsp;gdy
+
'''while'''( Q++ <= 5,
 
+
        '''if'''( Q == 0, '''next'''() );
::<math>s =  
+
        P = 0;
\begin{cases}
+
        '''while'''( P++ <= 10,
\;\;\: 1 & \text{gdy } r = 1 \\
+
              D = P^2 - 4*Q;
      - 1 & \text{gdy } r = 7 \\
+
              '''if'''( D == 0,
\end{cases}</math>
+
                  '''print'''("Q= ", Q, "  P= ", P, "  ------------------");
 
+
                  '''next'''();
dla <math>2^n = 8</math>. Dla <math>2^n = 8</math> i <math>r = 3, 5</math> rozpatrywana kongruencja nie ma rozwiązania.<br/>
+
                );
&#9633;
+
              m = 3;
 +
              '''while'''( m < Stop,
 +
                      '''if'''( isPrimeOr<span style="background-color: #fee481;">SLPSP</span>(m, P, Q)  &&  !'''isprime'''(m),
 +
                          '''print'''("Q= ", Q, "  P= ", P, "  m= ", m, "  (D|m)= ", jacobi(D, m));
 +
                          '''break'''();
 +
                        );
 +
                      m = m + 2;
 +
                    );
 +
            );
 +
      );
 +
}</span>
 +
<br/>
 
{{\Spoiler}}
 
{{\Spoiler}}
  
 +
Żółtym tłem oznaczyliśmy te najmniejsze liczby pseudopierwsze Lucasa, dla których <math>(D \mid m) = - 1</math>.
  
  
<span style="font-size: 110%; font-weight: bold;">Uwaga K66</span><br/>
 
Poniżej udowodnimy trzy twierdzenia dotyczące istnienia liczb pierwszych, które są liczbami kwadratowymi modulo <math>p</math>. Pomysł ujęcia problemu zaczerpnęliśmy z&nbsp;pracy Alexandru Gicy<ref name="Gica1"/>. Zadanie K65 należy traktować jako uzupełnienie do dowodu twierdzenia K67. Z&nbsp;zadania łatwo widzimy, że powiązanie liczby <math>s</math> z&nbsp;postacią liczby pierwszej <math>p</math> nie jest przypadkowe.
 
  
Zauważmy, że twierdzenia ograniczają się do liczb pierwszych <math>p</math>, ponieważ dla liczb złożonych nieparzystych <math>m > 0</math> wynik <math>\left( {\small\frac{q}{m}} \right)_{\small{\!\! J}} = 1</math> nie oznacza, że liczba pierwsza <math>q</math> jest liczbą kwadratową modulo <math>m</math>.
+
<span style="font-size: 110%; font-weight: bold;">Przykład M38</span><br/>
 +
Ilość liczb SLPSP(<math>P, Q</math>) mniejszych od <math>10^9</math>
  
W tabeli przedstawiamy najmniejsze liczby pierwsze <math>q</math> postaci <math>4 k + 1</math> kwadratowe modulo <math>p</math>.
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 
+
! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<math>\boldsymbol{P}</math><br/><math>\boldsymbol{Q}</math>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
+
! <math>\boldsymbol{1}</math> !! <math>\boldsymbol{2}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math> !! <math>\boldsymbol{10}</math>
 +
|-
 +
! <math>\boldsymbol{- 5}</math>
 +
| <math>1056</math> || <math>1231</math> || <math>1184</math> || <math>1264</math> || <math>2278</math> || <math>1284</math> || <math>1181</math> || <math>1174</math> || <math>1281</math> || <math>1429</math>
 +
|-
 +
! <math>\boldsymbol{- 4}</math>
 +
| <math>1043</math> || <math>1165</math> || <math>2139</math> || <math>1316</math> || <math>1151</math> || <math>1079</math> || <math>1112</math> || <math>2377</math> || <math>1197</math> || <math>989</math>
 +
|-
 +
! <math>\boldsymbol{- 3}</math>
 +
| <math>952</math> || <math>1514</math> || <math>1055</math> || <math>1153</math> || <math>1135</math> || <math>2057</math> || <math>998</math> || <math>1202</math> || <math>1077</math> || <math>1112</math>
 +
|-
 +
! <math>\boldsymbol{- 2}</math>
 +
| <math>1282</math> || <math>1092</math> || <math>1212</math> || <math>1510</math> || <math>1155</math> || <math>1179</math> || <math>1173</math> || <math>2240</math> || <math>1089</math> || <math>2109</math>
 +
|-
 +
! <math>\boldsymbol{- 1}</math>
 +
| <math>1165</math> || <math>1316</math> || <math>1079</math> || <math>2377</math> || <math>989</math> || <math>1196</math> || <math>1129</math> || <math>1050</math> || <math>1055</math> || <math>1147</math>  
 +
|-
 +
! <math>\boldsymbol{1}</math>
 +
| <math>282485800</math> || style="background-color: red" | <math></math> || <math>2278</math> || <math>2057</math> || <math>2113</math> || <math>2266</math> || <math>4053</math> || <math>2508</math> || <math>2285</math> || <math>3083</math>
 
|-
 
|-
! <math>\boldsymbol{p}</math>  
+
! <math>\boldsymbol{2}</math>
| <math>3</math> || <math>5</math> || <math>7</math> || <math>11</math> || <math>13</math> || <math>17</math> || <math>19</math> || <math>23</math> || <math>29</math> || <math>31</math> || <math>37</math> || <math>41</math> || <math>43</math> || <math>47</math> || <math>53</math> || <math>59</math> || <math>61</math> || <math>67</math> || <math>71</math> || <math>73</math> || <math>79</math> || <math>83</math> || <math>89</math> || <math>97</math>
+
| <math>1776</math> || <math>449152466</math> || <math>1282</math> || <math>1316</math> || <math>1645</math> || <math>1413</math> || <math>1564</math> || <math>1595</math> || <math>1683</math> || <math>1435</math>  
 
|-
 
|-
! <math>\boldsymbol{q}</math>  
+
! <math>\boldsymbol{3}</math>
| style="background-color: red" | <math>13</math> || style="background-color: red" | <math>29</math> || style="background-color: red" | <math>29</math> || <math>5</math> || style="background-color: red" | <math>17</math> || <math>13</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || style="background-color: red" | <math>41</math> || <math>5</math> || <math>13</math> || <math>17</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>17</math> || <math>5</math> || <math>37</math> || <math>5</math> || <math>17</math> || <math>5</math> || <math>53</math>
+
| <math>1621</math> || <math>1553</math> || <math>282485800</math> || <math>1514</math> || <math>1530</math> || <math>1510</math> || <math>1588</math> || <math>1549</math> || <math>1468</math> || <math>1692</math>  
|}
 
 
 
 
 
W kolejnej tabeli przedstawiamy najmniejsze liczby pierwsze <math>q</math> postaci <math>4 k + 3</math> kwadratowe modulo <math>p</math>.
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
 
 
|-
 
|-
! <math>\boldsymbol{p}</math>  
+
! <math>\boldsymbol{4}</math>
| <math>3</math> || <math>5</math> || <math>7</math> || <math>11</math> || <math>13</math> || <math>17</math> || <math>19</math> || <math>23</math> || <math>29</math> || <math>31</math> || <math>37</math> || <math>41</math> || <math>43</math> || <math>47</math> || <math>53</math> || <math>59</math> || <math>61</math> || <math>67</math> || <math>71</math> || <math>73</math> || <math>79</math> || <math>83</math> || <math>89</math> || <math>97</math>
+
| <math>2760</math> || <math>282485800</math> || <math>2978</math> || style="background-color: red" | <math></math> || <math>2137</math> || <math>2278</math> || <math>1995</math> || <math>2057</math> || <math>2260</math> || <math>2113</math>  
 
|-
 
|-
! <math>\boldsymbol{q}</math>  
+
! <math>\boldsymbol{5}</math>
| style="background-color: red" | <math>7</math> || style="background-color: red" | <math>11</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>3</math> || style="background-color: red" | <math>19</math> || <math>7</math> || <math>3</math> || <math>7</math> || <math>7</math> || <math>3</math> || <math>23</math> || <math>11</math> || <math>3</math> || <math>7</math> || <math>3</math> || <math>3</math> || <math>19</math> || <math>3</math> || <math>3</math> || <math>11</math> || <math>3</math> || <math>11</math> || <math>3</math>
+
| <math>1314</math> || <math>2392</math> || <math>1497</math> || <math>2392</math> || <math>1165</math> || <math>1268</math> || <math>1227</math> || <math>1411</math> || <math>1253</math> || <math>2377</math>  
 
|}
 
|}
  
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K67</span><br/>
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
Jeżeli <math>p \geqslant 11</math> jest liczbą pierwszą i <math>p \neq 17</math>, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 3</math> kwadratowa modulo <math>p</math>.
+
<span style="font-size: 90%; color:black;">NumOfSLPSP(Stop) =
 +
\\ ilość liczb silnie pseudopierwszych Lucasa SLPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
 +
{
 +
'''local'''(D, m, P, Q);
 +
Q = -6;
 +
'''while'''( Q++ <= 5,
 +
        '''if'''( Q == 0, '''next'''() );
 +
        P = 0;
 +
        '''while'''( P++ <= 10,
 +
              D = P^2 - 4*Q;
 +
              '''if'''( D == 0, '''print'''("Q= ", Q, "  P= ", P, "  ------------------"); '''next'''() );
 +
              s = 0;
 +
              m = 3;
 +
              '''while'''( m < Stop,
 +
                      '''if'''( isPrimeOr<span style="background-color: #fee481;">SLPSP</span>(m, P, Q)  &&  !'''isprime'''(m), s++ );
 +
                      m = m + 2;
 +
                    );
 +
              '''print'''("Q= ", Q, "  P= ", P, "  s= ", s);
 +
            );
 +
      );
 +
}</span>
 +
<br/>
 +
{{\Spoiler}}
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Niech
 
::<math>s =
 
\begin{cases}
 
\;\;\: 1 & \text{gdy } \, p \, \text{ jest postaci } \, 4 k + 1 \\
 
      - 1 & \text{gdy } \, p \, \text{ jest postaci } \, 4 k + 3 \\
 
\end{cases}</math>
 
  
Dla ustalonych liczb <math>n</math> i <math>s</math> rozważmy liczbę <math>u(a) = {\small\frac{p - s a^2}{2^n}}</math> taką, że <math>3 \leqslant u (a) < p</math>. Jeżeli liczba ta jest postaci <math>4 k + 3</math>, to ma dzielnik pierwszy <math>q < p</math> postaci <math>4 k + 3</math> (zobacz C21). Zatem możemy napisać <math>u (a) = t q</math>, co oznacza, że
 
  
::<math>p - s a^2 = 2^n u (a) = 2^n t q</math>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M39</span><br/>
 +
Można pokazać<ref name="Arnault1"/>, że dla liczby złożonej nieparzystej <math>m \neq 9</math> i&nbsp;ustalonego <math>D</math> ilość par <math>P, Q</math> takich, że
  
Czyli
+
:* <math>0 \leqslant P, Q < m</math>
 +
:* <math>\gcd (Q, m) = 1</math>
 +
:* <math>P^2 - 4 Q \equiv D \pmod{m}</math>
 +
:* <math>m</math> jest SLPSP(<math>P, Q</math>)
  
::<math>p \equiv s a^2 \pmod{q}</math>
+
nie przekracza <math>\tfrac{4}{15} n</math>.
  
i otrzymujemy
+
Nie dotyczy to przypadku, gdy <math>m = p (p + 2)</math> jest iloczynem liczb pierwszych bliźniaczych takich, że <math>(D \mid p) = - (D \mid p + 2) = - 1</math>, wtedy mamy słabsze oszacowanie: <math>\# (P, Q) \leqslant \tfrac{1}{2} n</math>. Zauważmy, że taką sytuację łatwo wykryć, bo w&nbsp;tym przypadku <math>m + 1 = (p + 1)^2</math> jest liczbą kwadratową.
  
::<math>\left( {\small\frac{q}{p}} \right)_{\small{\!\! J}} = s \cdot \left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = s \cdot \left( {\small\frac{s a^2}{q}} \right)_{\small{\!\! J}} = s \cdot \left( {\small\frac{s}{q}} \right)_{\small{\!\! J}} \cdot \left( {\small\frac{a^2}{q}} \right)_{\small{\!\! J}} =s \cdot \left( {\small\frac{s}{q}} \right)_{\small{\!\! J}} = 1</math>
 
  
Zatem liczba <math>q < p</math> jest liczbą kwadratową modulo <math>p</math>.
 
  
Pomysł dowodu polega na wskazaniu kilku liczb <math>u(a_1), \ldots, u(a_r)</math> takich, że
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M40</span><br/>
 +
Podobnie jak w&nbsp;przypadku liczb pseudopierwszych Lucasa LPSP(<math>P, Q</math>) tak i&nbsp;w&nbsp;przypadku liczb silnie pseudopierwszych Lucasa SLPSP(<math>P, Q</math>) możemy testować pierwszość liczby <math>m</math>, wybierając liczby <math>P, Q</math> losowo lub zastosować wybraną metodę postępowania. Przedstawiony poniżej program, to zmodyfikowany kod z uwagi M36. Teraz parametry <math>P, Q</math> są wybierane metodą Selfridge'a, a symbol Jacobiego <math>(D \mid m)</math> jest równy <math>- 1</math>.
  
::<math>3 \leqslant u(a_1) < \ldots < u(a_r) < p</math>
+
<span style="font-size: 90%; color:black;">StrongLucasTest(m) =
 +
{
 +
'''local'''(a, b, c, k, P, Q, r, w, X);
 +
'''if'''( m % 2 == 0, '''return'''(m == 2) );
 +
'''if'''( '''issquare'''(m), '''return'''(0) ); \\ sprawdzamy, czy liczba m nie jest kwadratowa
 +
X = MethodA(m);
 +
P = X[1];
 +
Q = X[2];
 +
'''if'''( P == 0 || '''gcd'''(m, 2*Q) > 1, '''return'''(0) ); \\ jeżeli P = 0, to m jest liczbą złożoną
 +
r = '''valuation'''(m + 1, 2); \\ znajdujemy wykładnik, z jakim liczba 2 występuje w m + 1
 +
w = (m + 1) / 2^r;
 +
X =  modLucas(w, P, Q, m);
 +
a = X[1]; \\ U_w(P, Q) % m
 +
b = X[2]; \\ V_w(P, Q) % m
 +
'''if'''( a == 0 || b == 0, '''return'''(1) ); \\ b == 0 to przypadek k == 0
 +
'''if'''( r == 1, '''return'''(0) ); \\ nie ma dalszych przypadków
 +
c = modPower(Q, w, m); \\ Q^w % m
 +
k = 0;
 +
\\ sprawdzamy warunek V_(2^k * w) %m = 0; korzystamy ze wzoru V_(2*w) = (V_w)^2 - 2*Q^w
 +
'''while'''( k++ < r,
 +
        b = (b^2 - 2*c) % m;
 +
        '''if'''( b == 0, '''return'''(1) );
 +
        c = c^2 % m;
 +
      );
 +
'''return'''(0);
 +
}</span>
  
z których jedna musi być postaci <math>4 k + 3</math>.
 
  
'''Przypadek pierwszy:''' <math>\boldsymbol{p \equiv 3 \!\! \pmod{8}}</math>
 
  
Mamy <math>s = - 1</math> i&nbsp;przyjmujemy <math>n = 2</math>. Rozważmy liczby
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M41</span><br/>
 +
Najmniejsze liczby silnie pseudopierwsze Lucasa, które otrzymujemy po zastosowaniu metody Selfridge'a wyboru parametrów <math>P</math> i <math>Q</math>, to
  
::<math>3 \leqslant {\small\frac{p + 1}{4}} < {\small\frac{p + 9}{4}} < p</math>
+
::<math>5459, 5777, 10877, 16109, 18971, 22499, 24569, 25199, 40309, 58519, 75077, 97439, \ldots</math>
  
Oszacowania są jednocześnie spełnione dla <math>p \geqslant 11</math>. Z&nbsp;założenia <math>p = 8 k + 3</math>, zatem rozpatrywane liczby to <math>\{ 2 k + 1, 2 k + 3 \}</math>. Ponieważ są to dwie kolejne liczby nieparzyste, to jedna z&nbsp;nich jest postaci <math>4 k + 3</math>.
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 +
<span style="font-size: 90%; color:black;">'''forstep'''(k=1, 10^5, 2, '''if'''( StrongLucasTest(k) && !'''isprime'''(k), '''print'''(k)) )</span>
 +
<br/>
 +
{{\Spoiler}}
  
'''Przypadek drugi:''' <math>\boldsymbol{p \equiv 5 \!\! \pmod{8}}</math>
 
  
Mamy <math>s = + 1</math> i&nbsp;przyjmujemy <math>n = 2</math>. Rozważmy liczby
+
Tabela przedstawia ilość takich liczb nie większych od <math>10^n</math>
  
::<math>3 \leqslant {\small\frac{p - 9}{4}} < {\small\frac{p - 1}{4}} < p</math>
+
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: right; margin-right: auto;"
 +
! <math>\boldsymbol{n}</math> !! <math>\boldsymbol{3}</math> !! <math>\boldsymbol{4}</math> !! <math>\boldsymbol{5}</math> !! <math>\boldsymbol{6}</math> !! <math>\boldsymbol{7}</math> !! <math>\boldsymbol{8}</math> !! <math>\boldsymbol{9}</math>
 +
|-
 +
| #SLPSP <math>< 10^n</math> (metoda Selfridge'a) || <math>0</math> || <math>2</math> || <math>12</math> || <math>58</math> || <math>178</math> || <math>505</math> || <math>1415</math>
 +
|}
  
Oszacowania są jednocześnie spełnione dla <math>p \geqslant 21</math>. Z&nbsp;założenia <math>p = 8 k + 5</math>, zatem rozpatrywane liczby to <math>\{ 2 k - 1, 2 k + 1 \}</math>. Ponieważ są to dwie kolejne liczby nieparzyste, to jedna z&nbsp;nich jest postaci <math>4 k + 3</math>.
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
 +
<span style="font-size: 90%; color:black;">'''for'''(n=3, 9, s=0; '''forstep'''(k = 1, 10^n, 2, '''if'''( StrongLucasTest(k) && !'''isprime'''(k), s++ ) ); '''print'''("n=", n, "  ", s) )</span>
 +
<br/>
 +
{{\Spoiler}}
  
'''Przypadek trzeci:''' <math>\boldsymbol{p \equiv 7 \!\! \pmod{8}}</math>
 
  
Mamy <math>s = - 1</math> i&nbsp;przyjmujemy <math>n = 3</math>. Rozważmy liczby
 
  
::<math>3 \leqslant {\small\frac{p + 1}{8}} < {\small\frac{p + 9}{8}} < {\small\frac{p + 25}{8}} < {\small\frac{p + 49}{8}} < p</math>
 
  
Oszacowania są jednocześnie spełnione dla <math>p \geqslant 23</math>. Z&nbsp;założenia <math>p = 8 k + 7</math>, zatem rozpatrywane liczby to <math>\{ k + 1, k + 2, k + 4, k + 7 \}</math>. Jeżeli <math>k \equiv r \!\! \pmod{4}</math>, to modulo <math>4</math> mamy zbiór <math>\{ r + 1, r + 2, r, r + 3 \}</math>. Zatem jedna z&nbsp;liczb w&nbsp;tym zbiorze jest postaci <math>4 k + 3</math>.
 
  
'''Przypadek czwarty:''' <math>\boldsymbol{p \equiv 1 \!\! \pmod{8}}</math>
+
== Test BPSW ==
  
Mamy <math>s = + 1</math> i&nbsp;przyjmujemy <math>n = 3</math>. Rozważmy liczby
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M42</span><br/>
 +
Jest <math>488</math> liczb SPSP(<math>2</math>) mniejszych od <math>10^8</math> i są 582 liczby SPSP(<math>3</math>) mniejsze od <math>10^8</math> (zobacz L21). Ale jest aż <math>21</math> liczb mniejszych od <math>10^8</math> silnie pseudopierwszych jednocześnie względem podstaw <math>2</math> i <math>3</math>:
  
::<math>3 \leqslant {\small\frac{p - 49}{8}} < {\small\frac{p - 25}{8}} < {\small\frac{p - 9}{8}} < {\small\frac{p - 1}{8}} < p</math>
+
<math>1373653, 1530787, 1987021, 2284453, 3116107, 5173601, 6787327, 11541307, 13694761, 15978007, 16070429,</math>
  
Oszacowania są jednocześnie spełnione dla <math>p \geqslant 73</math>. Z&nbsp;założenia <math>p = 8 k + 1</math>, zatem rozpatrywane liczby to <math>\{ k - 6, k - 3, k - 1, k \}</math>. Jeżeli <math>k \equiv r \!\! \pmod{4}</math>, to modulo <math>4</math> mamy zbiór <math>\{ r + 2, r + 1, r + 3, r \}</math>. Zatem jedna z&nbsp;liczb w&nbsp;tym zbiorze jest postaci <math>4 k + 3</math>.
+
<math>16879501, 25326001, 27509653, 27664033, 28527049, 54029741, 61832377, 66096253, 74927161, 80375707</math>
  
Pozostaje sprawdzić twierdzenie dla liczb pierwszych <math>p < 73</math>. Co kończy dowód.<br/>
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Pokaż kod|Hide=Ukryj kod}}
&#9633;
+
<span style="font-size: 90%; color:black;">'''forstep'''(m=3, 10^8, 2, '''if'''( isPrimeOr<span style="background-color: #fee481;">SPSP</span>(m, 2)  &&  isPrimeOr<span style="background-color: #fee481;">SPSP</span>(m, 3)  &&  !'''isprime'''(m), '''print'''("m=", m) ) )</span>
 +
<br/>
 
{{\Spoiler}}
 
{{\Spoiler}}
  
 +
Widzimy, że prawdopodobieństwo błędnego rozpoznania pierwszości w&nbsp;przypadku liczb mniejszych od <math>10^8</math> dla podstawy <math>2</math> lub podstawy <math>3</math> jest rzędu kilku milionowych. Gdyby prawdopodobieństwa błędnego rozpoznania pierwszości w&nbsp;przypadku podstawy <math>2</math> lub podstawy <math>3</math> były niezależne, to spodziewalibyśmy się, że nie będzie wcale liczb mniejszych od <math>10^8</math> silnie pseudopierwszych jednocześnie względem podstaw <math>2</math> i <math>3</math>, bo prawdopodobieństwo takiego zdarzenia byłoby równe kilkudziesięciu bilonowym. Ale tak nie jest.
  
 +
Jest to mocny argument za tym, że zastosowanie różnych (niezależnych) testów może być znacznie silniejszym narzędziem do testowania pierwszości liczb, niż wielokrotne stosowanie tego samego testu, gdzie poszczególne próby są tylko pozornie niezależne.
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K68</span><br/>
+
Połączenie znanych nam już testów prowadzi do prostego programu
Jeżeli <math>p \geqslant 11</math> jest liczbą pierwszą postaci <math>8 k + 1</math> lub <math>8 k + 3</math>, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 1</math> kwadratowa modulo <math>p</math>.
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
+
<span style="font-size: 90%; color:black;">BPSWtest(m) =
W przypadku, gdy liczba pierwsza <math>p</math> jest postaci <math>8 k + 1</math> lub <math>8 k + 3</math>, to istnieją takie liczby całkowite dodatnie <math>x, y</math>, że <math>p = x^2 + 2 y^2</math> (zobacz K62). Ponieważ z&nbsp;założenia <math>p \geqslant 11</math>, to musi być <math>x \neq y</math>. Z&nbsp;twierdzenia J22 wynika, że liczba <math>x^2 + y^2</math> ma dzielnik pierwszy <math>q</math> postaci <math>4 k + 1</math>. Łatwo widzimy, że <math>q \leqslant x^2 + y^2 < x^2 + 2 y^2 = p</math>.
+
{
 +
'''forprime'''(p = 2, 1000, '''if'''( m % p > 0, '''next'''() ); '''if'''( m == p, '''return'''(1), '''return'''(0) ));
 +
'''if'''( !isPrimeOr<span style="background-color: #fee481;">SPSP</span>(m, 2), '''return'''(0) );
 +
'''if'''( !StrongLucasTest(m), '''return'''(0), '''return'''(1) );
 +
}</span>
  
Modulo <math>q</math> możemy napisać
 
  
::<math>x^2 + y^2 \equiv 0 \!\! \pmod{q}</math>
 
  
Liczba pierwsza <math>q < p</math> nie może dzielić <math>y</math>, bo mielibyśmy <math>q \mid x</math>, czyli <math>q \mid p</math>, co jest niemożliwe. Rozpatrując równość <math>p = x^2 + 2 y^2</math> modulo <math>q</math>, dostajemy
+
Funkcja <code>BPSWtest(m)</code> kolejno sprawdza:
  
::<math>p \equiv y^2 \!\! \pmod{q}</math>
+
:* czy liczba <math>m</math> jest podzielna przez niewielkie liczby pierwsze (w naszym przypadku mniejsze od <math>1000</math>); jeśli tak, to sprawdza, czy <math>m</math> jest liczbą pierwszą, czy złożoną i&nbsp;zwraca odpowiednio <math>1</math> lub <math>0</math>
 +
:* czy liczba <math>m</math> przechodzi test Millera-Rabina dla podstawy <math>2</math>; jeśli nie, to zwraca <math>0</math>
 +
:* czy liczba <math>m</math> przechodzi silny test Lucasa dla parametrów <math>P</math> i <math>Q</math>, które wybieramy metodą Selfridge'a; jeśli nie, to zwraca <math>0</math>, w&nbsp;przeciwnym wypadku zwraca <math>1</math>
  
Wynika stąd natychmiast (zobacz J38 p.9)
 
  
::<math>\left( {\small\frac{q}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = \left( {\small\frac{y^2}{q}} \right)_{\small{\!\! J}} = 1</math>
+
Test w&nbsp;dokładnie takiej postaci zaproponowali Robert Baillie i&nbsp;Samuel Wagstaff<ref name="BaillieWagstaff1"/>. Nazwa testu to akronim, utworzony od pierwszych liter nazwisk Roberta Bailliego, Carla Pomerance'a, Johna Selfridge'a i&nbsp;Samuela Wagstaffa.
 
 
Co kończy dowód.<br/>
 
&#9633;
 
{{\Spoiler}}
 
  
 +
Nie jest znany żaden przykład liczby złożonej <math>m</math>, którą test BPSW<ref name="BPSW1"/><ref name="BPSW2"/> identyfikowałby jako pierwszą i&nbsp;z&nbsp;pewnością nie ma takich liczb dla <math>m < 2^{64} \approx 1.844 \cdot 10^{19}</math>. Warto przypomnieć: potrzebowaliśmy siedmiu testów Millera-Rabina (dla podstaw <math>2, 3, 5, 7, 11, 13, 17</math>), aby mieć pewność, że dowolna liczba <math>m < 3.41 \cdot 10^{14}</math> jest pierwsza (zobacz L22).
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K69</span><br/>
 
Jeżeli <math>p \geqslant 19</math> jest liczbą pierwszą postaci <math>12 k + 7</math>, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 1</math> kwadratowa modulo <math>p</math>.
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Z założenia <math>p \equiv 1 \!\! \pmod{6}</math>, zatem istnieją takie liczby <math>x, y \in \mathbb{Z}_+</math>, że <math>p = x^2 + 3 y^2</math> (zobacz K62).
 
Liczby <math>x, y</math> muszą mieć przeciwną parzystość i&nbsp;być względnie pierwsze. Gdyby liczba <math>x</math> była nieparzysta, to modulo <math>4</math> mielibyśmy
 
  
::<math>1 + 3 \cdot 0 \equiv 3 \!\! \pmod{4}</math>
 
  
Co jest niemożliwe. Zatem <math>x = 2 k</math>, a&nbsp;liczba <math>y</math> musi być nieparzysta. Otrzymujemy
+
== Uzupełnienia ==
  
::<math>p = 4 k^2 + 3 y^2 = 4 (k^2 + y^2) - y^2</math>
+
&nbsp;
  
Ponieważ <math>p</math> jest liczbą pierwszą, to jedynie w&nbsp;przypadku gdy <math>k = y = 1</math> możliwa jest sytuacja, że <math>k = y</math>. Mielibyśmy wtedy <math>p = 7</math>, ale z&nbsp;założenia musi być <math>p \geqslant 19</math>. Wynika stąd, że <math>k \neq y</math>, zatem liczba <math>k^2 + y^2</math> ma dzielnik pierwszy <math>q</math> postaci <math>4 k + 1</math> (zobacz J22). Oczywiście <math>q \leqslant k^2 + y^2 < 4 k^2 + 3 y^2 = p</math>.
+
=== <span style="border-bottom:1px solid #000;">Pewne własności współczynników dwumianowych</span> ===
  
Modulo <math>q</math> możemy napisać
+
&nbsp;
  
::<math>k^2 + y^2 \equiv 0 \!\! \pmod{q}</math>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M43</span><br/>
 +
Jeżeli <math>p</math> jest liczbą pierwszą, to
  
Liczba pierwsza <math>q</math> nie może dzielić <math>y</math>, bo mielibyśmy <math>q \mid k</math>, czyli <math>q \mid p</math>, co jest niemożliwe. Rozpatrując równość <math>p = 4 (k^2 + y^2) - y^2</math> modulo <math>q</math>, dostajemy
+
::<math>\binom{p}{k} \equiv 0 \pmod{p}</math>
  
::<math>p \equiv - y^2 \!\! \pmod{q}</math>
+
dla każdego <math>k \in [1, p - 1]</math>.
  
Wynika stąd natychmiast (zobacz J38 p.9 i&nbsp;p.6)
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 +
Łatwo zauważamy, że dla <math>k \in [1, p - 1]</math> liczba pierwsza <math>p</math> dzieli licznik, ale nie dzieli mianownika współczynnika dwumianowego
  
::<math>\left( {\small\frac{q}{p}} \right)_{\small{\!\! J}}  
+
::<math>\binom{p}{k} = {\small\frac{p!}{k! \cdot (p - k)!}}</math>
= \left( {\small\frac{p}{q}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{- y^2}{q}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{- 1}{q}} \right)_{\small{\!\! J}} \cdot \left( {\small\frac{y^2}{q}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{- 1}{q}} \right)_{\small{\!\! J}} = 1</math>
 
  
Co kończy dowód.<br/>
+
zatem <math>p \biggr\rvert \binom{p}{k}</math>. Co należało pokazać.<br/>
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 2538: Linia 1921:
  
  
Twierdzenia K68 i&nbsp;K69 można uogólnić na wszystkie liczby pierwsze.<ref name="Gica1"/><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M44</span><br/>
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K70*</span><br/>
+
Jeżeli <math>p</math> jest liczbą pierwszą nieparzystą, to
Jeżeli <math>p \geqslant 11</math> jest liczbą pierwszą i <math>p \neq 13, 37</math>, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 1</math> kwadratowa modulo <math>p</math>.
 
  
 +
::<math>\binom{p + 1}{k} \equiv 0 \pmod{p}</math>
  
 
+
dla każdego <math>k \in [2, p - 1]</math>.
<span style="font-size: 110%; font-weight: bold;">Uwaga K71</span><br/>
 
W tabeli przedstawiamy najmniejsze liczby pierwsze <math>q</math> postaci <math>4 k + 1</math> niekwadratowe modulo <math>m</math>.
 
 
 
:{| class="wikitable plainlinks"  style="font-size: 80%; text-align: center; margin-right: auto;"
 
|-
 
! <math>\boldsymbol{m}</math>
 
| <math>2</math> || <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math> || <math>16</math> || <math>17</math> || <math>18</math> || <math>19</math> || <math>20</math> || <math>21</math> || <math>22</math> || <math>23</math> || <math>24</math> || <math>25</math> || <math>26</math> || <math>27</math> || <math>28</math> || <math>29</math> || <math>30</math> || <math>31</math> || <math>32</math> || <math>33</math> || <math>34</math> || <math>35</math> || <math>36</math> || <math>37</math> || <math>38</math> || <math>39</math> || <math>40</math>
 
|-
 
! <math>\boldsymbol{q}</math>
 
| style="background-color: red" | <math>-</math> || style="background-color: red" | <math>5</math> || style="background-color: red" | <math>-</math> || style="background-color: red" | <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>5</math> || style="background-color: red" | <math>13</math> || style="background-color: red" | <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>13</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>17</math> || <math>13</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>13</math>
 
|}
 
 
 
 
 
W kolejnej tabeli przedstawiamy najmniejsze liczby pierwsze <math>q</math> postaci <math>4 k + 3</math> niekwadratowe modulo <math>m</math>.
 
 
 
:{| class="wikitable plainlinks"  style="font-size: 80%; text-align: center; margin-right: auto;"
 
|-
 
! <math>\boldsymbol{m}</math>
 
| <math>2</math> || <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math> || <math>16</math> || <math>17</math> || <math>18</math> || <math>19</math> || <math>20</math> || <math>21</math> || <math>22</math> || <math>23</math> || <math>24</math> || <math>25</math> || <math>26</math> || <math>27</math> || <math>28</math> || <math>29</math> || <math>30</math> || <math>31</math> || <math>32</math> || <math>33</math> || <math>34</math> || <math>35</math> || <math>36</math> || <math>37</math> || <math>38</math> || <math>39</math> || <math>40</math>
 
|-
 
! <math>\boldsymbol{q}</math>
 
| style="background-color: red" | <math>-</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>3</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>3</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>7</math> || <math>7</math> || <math>7</math> || <math>3</math> || <math>7</math> || <math>3</math> || <math>3</math> || <math>11</math> || <math>3</math> || <math>3</math> || <math>11</math> || <math>7</math> || <math>7</math> || <math>7</math> || <math>3</math> || <math>7</math> || <math>11</math> || <math>3</math> || <math>3</math> || <math>7</math> || <math>3</math> || <math>3</math> || <math>7</math> || <math>3</math> || <math>3</math> || <math>7</math> || <math>19</math> || <math>3</math> || <math>7</math> || <math>3</math>
 
|}
 
 
 
 
 
 
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K72</span><br/>
 
Jeżeli <math>m \geqslant 7</math> jest liczbą całkowitą postaci <math>4 k + 3</math>, to istnieje liczba pierwsza <math>q < m</math> postaci <math>4 k + 3</math> niekwadratowa modulo <math>m</math>.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
Ponieważ liczba <math>m - 4 \geqslant 3</math> jest postaci <math>4 k + 3</math>, to ma dzielnik pierwszy <math>q < m</math> postaci <math>4 k + 3</math> (zobacz C21). Czyli <math>m - 4 = k q</math> i&nbsp;z&nbsp;twierdzenia J38 p.9 dostajemy
+
Jeżeli <math>k \in [2, p - 1]</math>, to modulo <math>p</math> dostajemy
  
::<math>\left( {\small\frac{q}{m}} \right)_{\small{\!\! J}} =
+
::<math>\binom{p + 1}{k} = \binom{p}{k} + \binom{p}{k - 1} \equiv 0 \pmod{p}</math>
- \left( {\small\frac{m}{q}} \right)_{\small{\!\! J}} =
 
- \left( {\small\frac{k q + 4}{q}} \right)_{\small{\!\! J}} =
 
- \left( {\small\frac{4}{q}} \right)_{\small{\!\! J}} = - 1</math>
 
  
Zatem <math>q</math> jest liczbą niekwadratową modulo <math>m</math>. Co należało pokazać.<br/>
+
Bo liczba pierwsza <math>p</math> dzieli licznik, ale nie dzieli mianownika współczynników dwumianowych po prawej stronie. Co należało pokazać.<br/>
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 2587: Linia 1939:
  
  
Można też pokazać, że<ref name="Pollack2"/><br/>
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M45</span><br/>
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K73*</span><br/>
+
Jeżeli <math>p</math> jest liczbą pierwszą, to
'''A.''' Jeżeli <math>p \geqslant 13</math> jest liczbą pierwszą, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 1</math> niekwadratowa modulo <math>p</math>.
 
 
 
'''B.''' Jeżeli <math>p \geqslant 5</math> jest liczbą pierwszą, to istnieje liczba pierwsza <math>q < p</math> postaci <math>4 k + 3</math> niekwadratowa modulo <math>p</math>.
 
  
 +
::<math>\binom{p - 1}{k} \equiv (- 1)^k \pmod{p}</math>
  
 
+
dla każdego <math>k \in [0, p - 1]</math>.
Zauważmy, że twierdzenie K73 można łatwo uogólnić na liczby całkowite dodatnie.<br/>
 
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K74</span><br/>
 
'''A.''' Jeżeli <math>m \geqslant 6</math> jest liczbą całkowitą i <math>m \neq 10 , 11</math>, to istnieje liczba pierwsza <math>q < m</math> postaci <math>4 k + 1</math> niekwadratowa modulo <math>m</math>.
 
 
 
'''B.''' Jeżeli <math>m \geqslant 4</math> jest liczbą całkowitą i <math>m \neq 6 , 9</math>, to istnieje liczba pierwsza <math>q < m</math> postaci <math>4 k + 3</math> niekwadratowa modulo <math>m</math>.
 
  
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 +
Łatwo sprawdzamy, że twierdzenie jest prawdziwe dla liczby pierwszej parzystej <math>p = 2</math>. Załóżmy, że <math>p</math> jest liczbą pierwszą nieparzystą. Równie łatwo sprawdzamy, że twierdzenie jest prawdziwe dla <math>k = 0</math> i <math>k = 1</math>. Zauważmy, że dla <math>k \in [1, p - 1]</math> jest
  
'''Punkt B'''
+
::<math>\binom{p - 1}{k} = {\small\frac{(p - 1) !}{k! (p - 1 - k) !}} = {\small\frac{p - k}{k}} \cdot {\small\frac{(p - 1) !}{(k - 1) ! (p - k) !}} = {\small\frac{p - k}{k}} \cdot \binom{p - 1}{k - 1} = {\small\frac{p}{k}} \cdot \binom{p - 1}{k - 1} - \binom{p - 1}{k - 1}</math>
  
Rozważmy liczby <math>m</math> postaci <math>m = 2^a 3^b</math>.
+
Ponieważ współczynniki dwumianowe są liczbami całkowitymi, a&nbsp;liczba <math>k \in [2, p - 1]</math> nie dzieli liczby pierwszej nieparzystej <math>p</math>, to <math>k</math> musi dzielić liczbę <math>\binom{p - 1}{k - 1}</math>. Zatem dla <math>k \in [2, p - 1]</math> modulo <math>p</math> mamy
  
Jeżeli <math>3 \mid m</math>, to <math>11</math> jest liczbą niekwadratową modulo <math>m</math>, bo <math>\left( {\small\frac{11}{3}} \right)_{\small{\!\! J}} = - 1</math> (zobacz J52 i&nbsp;K47).
+
::<math>\binom{p - 1}{k} \equiv - \binom{p - 1}{k - 1}\pmod{p}</math>
  
Jeżeli <math>3 \nmid m</math>, ale <math>8 \mid m</math>, to <math>8 \nmid (11 - 1)</math>, zatem liczba <math>11</math> jest liczbą niekwadratową modulo <math>m</math> (zobacz J52).
+
Skąd otrzymujemy
  
Jeżeli <math>3 \nmid m</math> i <math>8 \nmid m</math>, ale <math>4 \mid m</math>, to <math>4 \nmid (11 - 1)</math>, zatem liczba <math>11</math> jest liczbą niekwadratową modulo <math>m</math> (zobacz J52).
+
::<math>\binom{p - 1}{k} \equiv (- 1)^1 \binom{p - 1}{k - 1} \equiv (- 1)^2 \binom{p - 1}{k - 2} \equiv \ldots \equiv (- 1)^{k - 2} \binom{p - 1}{2} \equiv (- 1)^{k - 1} \binom{p - 1}{1} \equiv (- 1)^k \pmod{p}</math>
  
Jeżeli <math>m = 2</math>, to łatwo zauważamy, że nie istnieją liczby niekwadratowe modulo <math>2</math>.
+
Co należało pokazać.<br/>
 +
&#9633;
 +
{{\Spoiler}}
  
  
Zbierając:
 
  
:* jeśli liczba <math>m \geqslant 12</math> nie ma dzielnika pierwszego <math>p \geqslant 5</math>, czyli jest postaci <math>m = 2^a 3^b</math>, to liczba pierwsza <math>q = 11</math> jest mniejsza od <math>m</math>, jest postaci <math>4 k + 3</math> i&nbsp;jest liczbą niekwadratową modulo <math>m</math>.
+
<span style="font-size: 110%; font-weight: bold;">Twierdzenie M46</span><br/>
:* jeśli liczba <math>m \geqslant 12</math> ma dzielnik pierwszy <math>p \geqslant 5</math>, to istnieje liczba pierwsza <math>q < p \leqslant m</math> taka, że <math>q</math> jest postaci <math>4 k + 3</math> i&nbsp;jest liczbą niekwadratową modulo <math>m</math> (zobacz K73 i&nbsp;K47).
+
Dla współczynników dwumianowych prawdziwe są następujące wzory
  
 +
::<math>\underset{k \; \text{parzyste}}{\sum_{k = 0}^{n}} \binom{n}{k} = 2^{n - 1}</math>
  
Pozostaje wypisać dla liczb <math>3 \leqslant m \leqslant 11</math> najmniejsze liczby niekwadratowe, które są liczbami pierwszymi postaci <math>4 k + 3</math>.
+
::<math>\underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^{n - 1}</math>
  
<span style="font-size: 90%; color:black;">'''for'''(m = 3, 15, '''forprimestep'''(q = 3, 100, 4, '''if'''( isQR(q,m) == -1, '''print'''(m, "  ", q); '''break'''() )))</span>
+
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 +
Ze wzoru dwumianowego
  
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
+
::<math>(a + b)^n = \sum_{k = 0}^{n} \binom{n}{k} a^{n - k} b^k</math>
|-
 
! <math>\boldsymbol{m}</math>
 
| <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math>
 
|-
 
! <math>\boldsymbol{q}</math>
 
| style="background-color: red" | <math>11</math> || <math>3</math> || <math>3</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>3</math> || style="background-color: red" | <math>11</math> || <math>3</math> || <math>7</math> || <math>7</math> || <math>7</math> || <math>3</math> || <math>7</math>
 
|}
 
  
Widzimy, że twierdzenie jest prawdziwe dla <math>m \geqslant 4</math>, o ile <math>m \neq 6 , 9</math>.
+
z łatwością otrzymujemy
  
'''Punkt A'''
+
::<math>(1 + 1)^n = \sum_{k = 0}^{n} \binom{n}{k} = 2^n</math>
  
Rozważmy liczby <math>m</math> postaci <math>m = 2^a 3^b 5^c 7^d 11^e</math>.
+
::<math>(1 - 1)^n = \sum_{k = 0}^{n} (- 1)^k \binom{n}{k} = 0</math>
  
Jeżeli jedna z&nbsp;liczb <math>3, 5, 7, 11</math> dzieli <math>m</math>, to <math>17</math> jest liczbą niekwadratową modulo <math>m</math>, bo
+
Obliczając sumę i&nbsp;różnicę powyższych wzorów mamy
<math>\left( {\small\frac{17}{3}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{17}{5}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{17}{7}} \right)_{\small{\!\! J}}
 
= \left( {\small\frac{17}{11}} \right)_{\small{\!\! J}}
 
= - 1</math>.
 
  
Jeżeli żadna z&nbsp;liczb <math>3, 5, 7, 11</math> nie dzieli <math>m</math>, ale <math>8 \mid m</math>, to <math>8 \nmid (5 - 1)</math>, zatem liczba <math>5</math> jest liczbą niekwadratową modulo <math>m</math>.
+
::<math>\sum_{k = 0}^{n} \binom{n}{k} (1 + (- 1)^k) = 2 \underset{k \; \text{parzyste}}{\sum^n_{k = 0}} \binom{n}{k} = 2^n</math>
  
Jeżeli żadna z&nbsp;liczb <math>3, 5, 7, 11</math> nie dzieli <math>m</math> i <math>8 \nmid m</math>, ale <math>4 \mid m</math>, to nie istnieją liczby pierwsze postaci <math>4 k + 1</math> niekwadratowe modulo <math>m</math>, bo <math>4 \mid [(4 k + 1) - 1]</math>
+
::<math>\sum_{k = 0}^{n} \binom{n}{k} (1 - (- 1)^k) = 2 \underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^n</math>
  
Jeżeli <math>m = 2</math>, to łatwo zauważamy, że nie istnieją liczby niekwadratowe modulo <math>2</math>.
+
Skąd natychmiast wynika
  
Zbierając:
+
::<math>\underset{k \; \text{parzyste}}{\sum_{k = 0}^{n}} \binom{n}{k} = 2^{n - 1}</math>
  
:* jeśli liczba <math>m \geqslant 18</math> nie ma dzielnika pierwszego <math>p \geqslant 13</math>, czyli jest postaci <math>m = 2^a 3^b 5^c 7^d 11^e</math>, to liczba pierwsza <math>q = 5</math> lub <math>q = 17</math> jest mniejsza od <math>m</math>, jest postaci <math>4 k + 1</math> i&nbsp;jest liczbą niekwadratową modulo <math>m</math>.
+
::<math>\underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^{n - 1}</math>
:* jeśli liczba <math>m \geqslant 18</math> ma dzielnik pierwszy <math>p \geqslant 13</math>, to istnieje liczba pierwsza <math>q < p \leqslant m</math> taka, że <math>q</math> jest postaci <math>4 k + 1</math> i&nbsp;jest liczbą niekwadratową modulo <math>m</math> (zobacz K73 i&nbsp;K47).
 
  
Pozostaje wypisać dla liczb <math>3 \leqslant m \leqslant 17</math> najmniejsze liczby niekwadratowe, które są liczbami pierwszymi postaci <math>4 k + 1</math>.
+
Co należało pokazać.<br/>
 
 
<span style="font-size: 90%; color:black;">'''for'''(m = 3, 20, '''forprimestep'''(q = 1, 100, 4, '''if'''( isQR(q,m) == -1, '''print'''(m, "  ", q); '''break'''() )))</span>
 
 
 
::{| class="wikitable plainlinks"  style="font-size: 90%; text-align: center; margin-right: auto;"
 
|-
 
! <math>\boldsymbol{m}</math>
 
| <math>3</math> || <math>4</math> || <math>5</math> || <math>6</math> || <math>7</math> || <math>8</math> || <math>9</math> || <math>10</math> || <math>11</math> || <math>12</math> || <math>13</math> || <math>14</math> || <math>15</math> || <math>16</math> || <math>17</math> || <math>18</math> || <math>19</math> || <math>20</math>
 
|-
 
! <math>\boldsymbol{q}</math>
 
| style="background-color: red" | <math>5</math> || style="background-color: red" | <math>-</math> || style="background-color: red" | <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>5</math> || style="background-color: red" | <math>13</math> || style="background-color: red" | <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>5</math> || <math>5</math> || <math>5</math> || <math>13</math> || <math>13</math>
 
|}
 
 
 
Widzimy, że twierdzenie jest prawdziwe dla <math>m \geqslant 6</math>, o ile <math>m \neq 10 , 11</math>.<br/>
 
 
&#9633;
 
&#9633;
 
{{\Spoiler}}
 
{{\Spoiler}}
Linia 2678: Linia 2001:
  
  
<span style="font-size: 110%; font-weight: bold;">Twierdzenie K75</span><br/>
 
Jeżeli <math>p \geqslant 5</math> jest liczbą pierwszą, to istnieje liczba pierwsza nieparzysta <math>q < p</math> taka, że <math>\left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = - 1 .</math>
 
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Dowód|Hide=Ukryj dowód}}
 
Łatwo sprawdzamy, że
 
  
::<math>\left( {\small\frac{5}{3}} \right)_{\small{\!\! J}} = \left( {\small\frac{7}{5}} \right)_{\small{\!\! J}} = \left( {\small\frac{11}{3}} \right)_{\small{\!\! J}} = - 1</math>
+
=== <span style="border-bottom:1px solid #000;">Funkcje <span style="font-size: 95%; background-color: #f8f9fa"><tt>digits(m, b)</tt></span> oraz <span style="font-size: 95%; background-color: #f8f9fa"><tt>issquare(m)</tt></span></span> ===
  
(zobacz J38&nbsp;p.7). Zatem dowód wystarczy przeprowadzić dla <math>p \geqslant 13</math>.
+
&nbsp;
  
'''A. Liczba pierwsza''' <math>\, \boldsymbol{p} \,</math> '''jest postaci''' <math>\, \boldsymbol{4 k + 1}</math>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M47</span><br/>
 +
W funkcji <code>modLucas()</code> wykorzystaliśmy zaimplementowaną w&nbsp;PARI/GP funkcję
  
Niech liczba <math>q</math> będzie najmniejszą '''nieparzystą''' liczbą niekwadratową modulo <math>p</math>. Z&nbsp;twierdzenia K31 wiemy, że dla <math>p \geqslant 5</math> liczba <math>q</math> jest liczbą pierwszą i&nbsp;jest mniejsza od <math>p</math>. Ponieważ <math>p \equiv 1 \!\! \pmod{4}</math>, to z&nbsp;twierdzenia J38&nbsp;p.9 otrzymujemy natychmiast
+
<code>digits(m, b)</code> – zwraca wektor cyfr liczby <math>| m |</math> w&nbsp;systemie liczbowym o&nbsp;podstawie <math>b</math>
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
W naszym przypadku potrzebowaliśmy uzyskać wektor cyfr liczby <math>m</math> w&nbsp;układzie dwójkowym, czyli funkcję <code>digits(m, 2)</code> . Wprowadzenie tej funkcji pozwoliło zwiększyć czytelność kodu, ale bez trudu możemy ją sami napisać. Zauważmy, że do zapisania liczby <math>m \geqslant 1</math> potrzebujemy <math>\log_2 m + 1</math> cyfr. Zastępując funkcję <math>\log_2 m</math> funkcją <math>\left \lfloor \tfrac{\log m}{\log 2} \right \rfloor</math> musimy liczyć się z&nbsp;możliwym błędem zaokrąglenia – dlatego w&nbsp;programie deklarujemy wektor <code>V</code> o&nbsp;długości <code>floor( log(m)/log(2) ) + 2</code>. Zwracany wektor <code>W</code> ma już prawidłową długość.
::<math>\left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = \left( {\small\frac{q}{p}} \right)_{\small{\!\! J}} = - 1</math>
 
</div>
 
  
'''B. Liczba pierwsza''' <math>\, \boldsymbol{p} \,</math> '''jest postaci''' <math>\, \boldsymbol{4 k + 3}</math>
+
<span style="font-size: 90%; color:black;">Dec2Bin(m) =
 +
\\ zwraca wektor cyfr liczby m w układzie dwójkowym
 +
{
 +
'''local'''(i, k, V, W);
 +
'''if'''( m == 0, '''return'''([0]) );
 +
V = '''vector'''( '''floor'''( '''log'''(m)/'''log'''(2) ) + 2 ); \\ potrzeba floor( log(m)/log(2) ) + 1, ale błąd zaokrąglenia może zepsuć wynik
 +
k = 0;
 +
'''while'''( m > 0,
 +
        V[k++] = m % 2;
 +
        m = '''floor'''(m / 2);
 +
      );
 +
W = '''vector'''(k);
 +
'''for'''(i = 1, k, W[i] = V[k + 1 - i]);
 +
'''return'''(W);
 +
}
  
Z twierdzenia K67 wynika, że dla każdej liczby pierwszej <math>p \geqslant 11</math> postaci <math>4 k + 3</math> istnieje liczba pierwsza <math>q < p</math> taka, że <math>q</math> jest postaci <math>4 k + 3</math> i&nbsp;jest liczbą kwadratową modulo <math>p</math>. Ponieważ <math>p \equiv q \equiv 3 \!\! \pmod{4}</math>, to z&nbsp;twierdzenia J38 p.9 otrzymujemy natychmiast
 
  
<div style="margin-top: 1em; margin-bottom: 1em;">
 
::<math>\left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = - \left( {\small\frac{q}{p}} \right)_{\small{\!\! J}} = - 1</math>
 
</div>
 
  
Co kończy dowód.<br/>
+
<span style="font-size: 110%; font-weight: bold;">Uwaga M48</span><br/>
&#9633;
+
W funkcjach <code>LucasTest()</code> i <code>StrongLucasTest()</code> wykorzystaliśmy zaimplementowaną w&nbsp;PARI/GP funkcję
{{\Spoiler}}
 
  
 +
<code>issquare(m)</code> – sprawdza, czy liczba <math>m</math> jest liczbą kwadratową
  
 +
Wprowadzenie tej funkcji pozwoliło zwiększyć czytelność kodu, ale bez trudu możemy ją sami napisać. Potrzebna nam będzie funkcja, która znajduje całość z&nbsp;pierwiastka z&nbsp;liczby <math>m</math>, czyli <math>\left\lfloor \sqrt{m} \right\rfloor</math>. Wykorzystamy tutaj ciąg
  
<span style="font-size: 110%; font-weight: bold;">Zadanie K76</span><br/>
+
::<math>a_{k + 1} =
Udowodnić twierdzenie K75 w&nbsp;przypadku, gdy liczba pierwsza <math>p \geqslant 19</math> jest postaci <math>4 k + 3</math>, nie korzystając z&nbsp;twierdzenia K67.
+
  \begin{cases}
 +
  \qquad \;\; 1 & \text{gdy } k = 0 \\
 +
      \tfrac{1}{2} \left( a_k + \tfrac{x}{a_k} \right) & \text{gdy } k > 0
 +
  \end{cases}</math>
  
{{Spoiler|Style = font-style: italic; font-weight: bold; color: olive; text-decoration: underline;|Show=Rozwiązanie|Hide=Ukryj rozwiązanie}}
+
którego granicą jest <math>\sqrt{x}</math> <ref name="pierwiastek1"/>.
Z założenia <math>p = 4 k + 3</math>. Liczba <math>k</math> może być postaci <math>k = 3 j</math>, <math>k = 3 j + 1</math> i <math>k = 3 j + 2</math>. Odpowiada to liczbom pierwszym postaci <math>p = 12 j + 3</math>, <math>p = 12 j + 7</math> i <math>p = 12 j + 11</math>.
 
  
Ponieważ nie ma liczb pierwszych <math>p \geqslant 19</math> i&nbsp;będących postaci <math>p = 12 j + 3</math>, to pozostaje rozważyć przypadki <math>p = 12 j + 7</math> i <math>p = 12 j + 11</math>.
+
Modyfikując powyższą definicję tak, aby operacje były zawsze wykonywane na liczbach całkowitych<ref name="IntegerSquareRoot1"/>
  
'''A. Liczba pierwsza''' <math>\, \boldsymbol{p} \,</math> '''jest postaci''' <math>\, \boldsymbol{12 j + 11}</math>
+
::<math>a_{k + 1} =
 +
  \begin{cases}
 +
  \qquad \quad \; 1 & \text{gdy } k = 0 \\
 +
      \left\lfloor \tfrac{1}{2} \left( a_k + \left\lfloor \tfrac{m}{a_k} \right\rfloor \right) \right\rfloor & \text{gdy } k > 0
 +
  \end{cases}</math>
  
Wiemy, że w&nbsp;tym przypadku <math>\left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = + 1</math> (zobacz J43). Mamy
+
otrzymujemy ciąg, którego wszystkie wyrazy, począwszy od pewnego skończonego <math>n_0</math>, są równe <math>\left\lfloor \sqrt{m} \right\rfloor</math>. Nie dotyczy to przypadku, gdy <math>m + 1</math> jest liczbą kwadratową, wtedy, począwszy od pewnego skończonego <math>n_0</math>, wyrazy ciągu przyjmują na zmianę wartości <math>\left\lfloor \sqrt{m} \right\rfloor</math> oraz <math>\left\lfloor \sqrt{m} \right\rfloor + 1</math>.
  
<div style="margin-top: 1em; margin-bottom: 1em;">
+
Na tej podstawie możemy w&nbsp;PARI/GP napisać funkcję
::<math>\left( {\small\frac{p}{3}} \right)_{\small{\!\! J}} = - \left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = - 1</math>
 
</div>
 
  
Czyli wystarczy przyjąć <math>q = 3</math>.
+
<span style="font-size: 90%; color:black;">intSqrt(m) =  
 
+
{
'''B. Liczba pierwsza''' <math>\, \boldsymbol{p} \,</math> '''jest postaci''' <math>\, \boldsymbol{12 j + 7}</math>
+
'''local'''(a, b);
 
+
'''if'''( m == 0, '''return'''(0) );
Wiemy, że w&nbsp;tym przypadku <math>\left( {\small\frac{- 1}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = - 1</math> (zobacz J38&nbsp;p.6 oraz J43). Otrzymujemy
+
a = 2^( '''floor'''( '''log'''(m)/'''log'''(2)/2 ) + 2 ); \\ musi być a > sqrt(m)
 
+
b = '''floor'''(( a + '''floor'''( m/a ) )/2);
<div style="margin-top: 1em; margin-bottom: 1em;">
+
'''while'''( b < a,
::<math>\left( {\small\frac{p}{p - 12}} \right)_{\small{\!\! J}} = - \left( {\small\frac{p - 12}{p}} \right)_{\small{\!\! J}} = - \left( {\small\frac{- 12}{p}} \right)_{\small{\!\! J}} = \left[ - \left( {\small\frac{- 1}{p}} \right)_{\small{\!\! J}} \right] \cdot \left( {\small\frac{2^2}{p}} \right)_{\small{\!\! J}} \cdot \left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = \left( {\small\frac{3}{p}} \right)_{\small{\!\! J}} = -1</math>
+
        a = b;
</div>
+
        b = '''floor'''( ( a + '''floor'''(m/a) )/2 );
 +
      );
 +
'''return'''(a);
 +
}</span>
  
Ponieważ liczba <math>p - 12 \geqslant 7</math> jest nieparzysta, to musi istnieć nieparzysty dzielnik pierwszy <math>q < p</math> liczby <math>p - 12</math> taki, że <math>\left( {\small\frac{p}{q}} \right)_{\small{\!\! J}} = - 1</math>. W&nbsp;przeciwnym razie z&nbsp;twierdzenia J38&nbsp;p.4 mielibyśmy <math>\left( {\small\frac{p}{p - 12}} \right)_{\small{\!\! J}} = 1</math>. Co kończy dowód.<br/>
+
Oczywiście liczba <math>m</math> jest liczbą kwadratową, wtedy i&nbsp;tylko wtedy, gdy <math>m = \left\lfloor \sqrt{m} \right\rfloor^2</math>, zatem wystarczy sprawdzić, czy <code>m == intSqrt(m)^2</code>.
&#9633;
 
{{\Spoiler}}
 
  
  
Linia 2757: Linia 2091:
 
<references>
 
<references>
  
<ref name="Dukic1">Dušan Đukić, ''Quadratic Congruences'', International Mathematical Olympiad training materials, ([https://imomath.com/index.cgi?page=quadraticCongruencesSumsLegendreSymbols IMOmath.com])</ref>
+
<ref name="BaillieWagstaff1">Robert Baillie and Samuel S. Wagstaff Jr., ''Lucas Pseudoprimes'', Mathematics of Computation Vol. 35, No. 152 (1980), ([http://mpqs.free.fr/LucasPseudoprimes.pdf LINK])</ref>
 
 
<ref name="Hasse1">Helmut Hasse, ''Zur Theorie der abstrakten elliptischen Funktionenkörper. I. Die Struktur der Gruppe der Divisisorenklassen endlicher Ordnung. II. Automorphismen und Meromorphismen. Das Additionstheorem. III. Die Struktur des Meromorphismenrings. Die Riemannsche Vermutung'', Journal für die reine und angewandte Mathematik 175 (1936) 55–62, 69–88, 193–207.</ref>
 
 
 
<ref name="Hasse2">Wikipedia, ''Hasse's theorem on elliptic curves'', ([https://en.wikipedia.org/wiki/Hasse%27s_theorem_on_elliptic_curves Wiki-en]), ([https://ru.wikipedia.org/wiki/%D0%A2%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D0%B0_%D0%A5%D0%B0%D1%81%D1%81%D0%B5 Wiki-ru])</ref>
 
 
 
<ref name="Manin1">Yu. I. Manin, ''On cubic congruences to a prime modulus'', Izv. Akad. Nauk SSSR Ser. Mat., 1956, Volume 20, Issue 5, 673–678</ref>
 
 
 
<ref name="Norton1">Karl K. Norton, ''Numbers with Small Prime Factors, and the Least ''k''th Power Non-Residue'', Memoirs of the American Mathematical Society, No. 106 (1971)</ref>
 
 
 
<ref name="Trevino1">Enrique Treviño, ''The least k-th power non-residue'', Journal of Number Theory, Volume 149 (2015)</ref>
 
 
 
<ref name="Trevino2">Kevin J. McGown and Enrique Treviño, ''The least quadratic non-residue'', Mexican Mathematicians in the World (2021)</ref>
 
 
 
<ref name="Erdos1">Paul Erdős, ''Számelméleti megjegyzések I'', Afar. Lapok, v. 12 (1961)</ref>
 
  
<ref name="Pollack1">Paul Pollack, ''The average least quadratic nonresidue modulo <math>m</math> and other variations on a&nbsp;theme of Erdős'', Journal of Number Theory, Vol. 132 (2012), No. 6, pp. 1185-1202.</ref>
+
<ref name="Arnault1">François Arnault, ''The Rabin-Monier Theorem for Lucas Pseudoprimes'', Mathematics of Computation Vol. 66, No. 218 (1997)</ref>
  
<ref name="InfiniteDescent1">Wikipedia, ''Proof by infinite descent'', ([https://en.wikipedia.org/wiki/Proof_by_infinite_descent Wiki-en])</ref>
+
<ref name="pierwiastek1">Wikipedia, ''Pierwiastek kwadratowy'', ([https://pl.wikipedia.org/wiki/Metody_obliczania_pierwiastka_kwadratowego#Metoda_babilo%C5%84ska Wiki-pl]), ([https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method Wiki-en])</ref>
  
<ref name="Bussey1">W. H. Bussey, ''Fermat's Method of Infinite Descent'', The American Mathematical Monthly, Vol. 25, No. 8 (1918)</ref>
+
<ref name="IntegerSquareRoot1">Wikipedia, ''Integer square root'', ([https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division Wiki-en])</ref>
  
<ref name="HardyWright1">G. H. Hardy and Edward M. Wright, ''An Introduction to the Theory of Numbers'', New York: Oxford University Press, 5th Edition, zobacz dowód Twierdzenia 366 w&nbsp;sekcji 20.4 na stronie 301.</ref>
+
<ref name="BPSW1">Wikipedia, ''Baillie–PSW primality test'', ([https://en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_test Wiki-en])</ref>
  
<ref name="Gica1">Alexandru Gica, ''Quadratic Residues of Certain Types'', Rocky Mountain J. Math. 36 (2006), no. 6, 1867-1871.</ref>
+
<ref name="BPSW2">MathWorld, ''Baillie-PSW Primality Test'', ([https://mathworld.wolfram.com/Baillie-PSWPrimalityTest.html LINK])</ref>
 
 
<ref name="Pollack2">Paul Pollack, ''The least prime quadratic nonresidue in a&nbsp;prescribed residue class mod 4'', Journal of Number Theory 187 (2018), 403-414</ref>
 
  
 
</references>
 
</references>
 
  
  

Wersja z 19:05, 8 lis 2023

11.01.2023



Ciągi Lucasa

Definicja M1
Niech [math]\displaystyle{ P, Q \in \mathbb{Z} \setminus \{0\} }[/math] oraz [math]\displaystyle{ D = P^2 - 4 Q \neq 0 }[/math]. Ciągi Lucasa [math]\displaystyle{ U_n = U_n (P, Q) }[/math] i [math]\displaystyle{ V_n = V_n (P, Q) }[/math] definiujemy następująco

[math]\displaystyle{ U_n = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} = {\small\frac{\alpha^n - \beta^n}{\sqrt{D}}} }[/math]
[math]\displaystyle{ V_n = \alpha^n + \beta^n }[/math]

gdzie liczby

[math]\displaystyle{ \alpha = {\small\frac{P + \sqrt{D}}{2}} }[/math]
[math]\displaystyle{ \beta = {\small\frac{P - \sqrt{D}}{2}} }[/math]

są pierwiastkami równania [math]\displaystyle{ x^2 - P x + Q = 0 }[/math].


Uwaga M2
Zauważmy, że:

[math]\displaystyle{ P = \alpha + \beta }[/math]
[math]\displaystyle{ Q = \alpha \beta }[/math]
[math]\displaystyle{ \sqrt{D} = \alpha - \beta }[/math]
[math]\displaystyle{ U_0 = 0 }[/math], [math]\displaystyle{ U_1 = 1 }[/math], [math]\displaystyle{ V_0 = 2 }[/math] i [math]\displaystyle{ V_1 = P }[/math]


Warunek [math]\displaystyle{ P^2 - 4 Q \neq 0 }[/math] wyklucza następujące pary [math]\displaystyle{ (P, Q) }[/math]

[math]\displaystyle{ (0, 0), (\pm 2, 1), (\pm 4, 4), (\pm 6, 9), (\pm 8, 16), (\pm 10, 25), (\pm 12, 36), ..., (\pm 2 n, n^2), ... }[/math]


Uwaga M3
Oczywiście liczby [math]\displaystyle{ \alpha }[/math] i [math]\displaystyle{ \beta }[/math] są również pierwiastkami równania

[math]\displaystyle{ x^{n + 2} - P x^{n + 1} + Q x^n = 0 }[/math]

Wynika stąd, że ciągi [math]\displaystyle{ (\alpha^n) }[/math] i [math]\displaystyle{ (\beta^n) }[/math] spełniają równania rekurencyjne

[math]\displaystyle{ \alpha^{n + 2} = P \alpha^{n + 1} - Q \alpha^n }[/math]
[math]\displaystyle{ \beta^{n + 2} = P \beta^{n + 1} - Q \beta^n }[/math]

Ciągi Lucasa [math]\displaystyle{ (U_n) }[/math] i [math]\displaystyle{ (V_n) }[/math] spełniają identyczne równania rekurencyjne jak ciągi [math]\displaystyle{ (\alpha^n) }[/math] i [math]\displaystyle{ (\beta^n) }[/math]. Istotnie, odejmując i dodając stronami wypisane powyżej równania, otrzymujemy

[math]\displaystyle{ U_{n + 2} = P U_{n + 1} - Q U_n }[/math]
[math]\displaystyle{ V_{n + 2} = P V_{n + 1} - Q V_n }[/math]

Dlatego możemy zdefiniować ciągi Lucasa [math]\displaystyle{ (U_n) }[/math] i [math]\displaystyle{ (V_n) }[/math] w sposób równoważny


Definicja M4
Niech [math]\displaystyle{ P, Q \in \mathbb{Z} \setminus \{0\} }[/math] oraz [math]\displaystyle{ D = P^2 - 4 Q \neq 0 }[/math]. Ciągi Lucasa [math]\displaystyle{ (U_n) }[/math] i [math]\displaystyle{ (V_n) }[/math] określone są następującymi wzorami rekurencyjnymi

[math]\displaystyle{ U_0 = 0 }[/math], [math]\displaystyle{ U_1 = 1 }[/math], [math]\displaystyle{ U_n = P U_{n - 1} - Q U_{n - 2} }[/math]
[math]\displaystyle{ V_0 = 2 }[/math], [math]\displaystyle{ V_1 = P }[/math], [math]\displaystyle{ V_n = P V_{n - 1} - Q V_{n - 2} }[/math]


Przykład M5
Początkowe wyrazy ciągów Lucasa


Uwaga M6
W PARI/GP możemy napisać prosty kod, który pozwoli obliczyć wartości wyrazów [math]\displaystyle{ U_n (P, Q) }[/math] i [math]\displaystyle{ V_n (P, Q) }[/math]

LucasU(n, P, Q) = if( n == 0, 0, if( n == 1, 1, P*LucasU(n-1, P, Q) - Q*LucasU(n-2, P, Q) ) )
LucasV(n, P, Q) = if( n == 0, 2, if( n == 1, P, P*LucasV(n-1, P, Q) - Q*LucasV(n-2, P, Q) ) )


Twierdzenie M7
Niech [math]\displaystyle{ D = P^2 - 4 Q }[/math]. Wyrazy ciągów Lucasa można przedstawić w postaci sumy

[math]\displaystyle{ 2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k }[/math]
[math]\displaystyle{ 2^{n - 1} V_n = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k }[/math]
Dowód

Oznaczmy [math]\displaystyle{ \delta = \sqrt{D} }[/math], zatem [math]\displaystyle{ 2 \alpha = P + \delta }[/math] i [math]\displaystyle{ 2 \beta = P - \delta }[/math]. Ze wzoru dwumianowego, mamy

[math]\displaystyle{ 2^n \alpha^n = (P + \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} \delta^j }[/math]
[math]\displaystyle{ 2^n \beta^n = (P - \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (- \delta)^j }[/math]

Obliczając sumę powyższych wzorów, otrzymujemy

[math]\displaystyle{ 2^n (\alpha^n + \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j + (- \delta)^j) }[/math]
[math]\displaystyle{ \quad \: = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} \cdot 2 \delta^{2 k} }[/math]
[math]\displaystyle{ \quad \: = 2 \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k }[/math]

gdzie [math]\displaystyle{ j = 2 k }[/math] i sumowanie przebiega od [math]\displaystyle{ k = 0 }[/math] do [math]\displaystyle{ k = \lfloor n / 2 \rfloor }[/math]

Zatem

[math]\displaystyle{ 2^{n - 1} V_n = \sum_{k = 0}^{\lfloor n / 2 \rfloor} \binom{n}{2 k} P^{n - 2 k} D^k }[/math]


Obliczając różnicę tych wzorów, mamy

[math]\displaystyle{ 2^n (\alpha^n - \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j - (- \delta)^j) }[/math]
[math]\displaystyle{ \quad \: = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} \cdot 2 \delta^{2 k + 1} }[/math]
[math]\displaystyle{ \quad \: = 2 \delta \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k }[/math]

gdzie [math]\displaystyle{ j = 2 k + 1 }[/math] i sumowanie przebiega od [math]\displaystyle{ k = 0 }[/math] do [math]\displaystyle{ k = \lfloor (n - 1) / 2 \rfloor }[/math]


Zatem

[math]\displaystyle{ 2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\sqrt{D}}} = 2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k }[/math]

Co należało pokazać.


Uwaga M8
Korzystając z twierdzenia M7, możemy napisać proste funkcje do znajdowania postaci kolejnych wyrazów [math]\displaystyle{ U_n (P, Q) }[/math] i [math]\displaystyle{ V_n (P, Q) }[/math]

U(n) = 2^(1 - n)*sum(k=0, floor((n-1)/2), binomial(n, 2*k+1) * P^(n-2*k-1) * (P^2-4*Q)^k)
V(n) = 2^(1 - n)*sum(k=0, floor(n/2), binomial(n, 2*k) * P^(n-2*k) * (P^2-4*Q)^k)


Często możemy spotkać założenie [math]\displaystyle{ P \geqslant 1 }[/math]. Poniższe twierdzenie wyjaśnia, dlaczego tak jest.

Twierdzenie M9
Jeżeli [math]\displaystyle{ (U_n) }[/math] i [math]\displaystyle{ (V_n) }[/math] są ciągami Lucasa, to

[math]\displaystyle{ U_n (- P, Q) = (- 1)^{n - 1} U_n (P, Q) }[/math]
[math]\displaystyle{ V_n (- P, Q) = (- 1)^n V_n (P, Q) }[/math]
Dowód

Niech

[math]\displaystyle{ \alpha = \frac{P + \sqrt{D}}{2} \qquad \qquad \;\; \beta = \frac{P - \sqrt{D}}{2} }[/math]
[math]\displaystyle{ a = \frac{- P + \sqrt{D}}{2} \qquad \qquad b = \frac{- P - \sqrt{D}}{2} }[/math]

Liczby [math]\displaystyle{ \alpha, \beta }[/math] oraz [math]\displaystyle{ a, b }[/math] są odpowiednio pierwiastkami równań

[math]\displaystyle{ x^2 - P x + Q = 0 }[/math]
[math]\displaystyle{ x^2 + P x + Q = 0 }[/math]

Zatem definiują one ciągi Lucasa

[math]\displaystyle{ U_n (P, Q) = \frac{\alpha^n - \beta^n}{\alpha - \beta} \qquad \qquad \;\; V_n (P, Q) = \alpha^n + \beta^n }[/math]
[math]\displaystyle{ U_n (- P, Q) = \frac{a^n - b^n}{a - b} \qquad \qquad V_n (- P, Q) = a^n + b^n }[/math]

Zauważmy, że

[math]\displaystyle{ \alpha - \beta = a - b = \sqrt{D} }[/math]
[math]\displaystyle{ \frac{a}{\beta} = \frac{b}{\alpha} = - 1 }[/math]

Łatwo znajdujemy

[math]\displaystyle{ U_n (- P, Q) = \frac{a^n - b^n}{a - b} = \frac{(- \beta)^n - (- \alpha)^n}{\sqrt{D}} = (- 1)^n \cdot \frac{\beta^n - \alpha^n}{\alpha - \beta} = (- 1)^{n - 1} \cdot U_n (P, Q) }[/math]
[math]\displaystyle{ V_n (- P, Q) = a^n + b^n = (- \beta)^n + (- \alpha)^n = (- 1)^n \cdot (\alpha^n + \beta^n) = (- 1)^n \cdot V_n (P, Q) }[/math]

Co należało pokazać.


Zadanie M10
Pokazać, że jeżeli [math]\displaystyle{ P, Q \in \mathbb{Z} \setminus \{ 0 \} }[/math] i [math]\displaystyle{ D = P^2 - 4 Q \neq 0 }[/math], to

[math]\displaystyle{ U_n (2 P, 4 Q) = 2^{n - 1} U_n (P, Q) }[/math]
[math]\displaystyle{ V_n (2 P, 4 Q) = 2^n V_n (P, Q) }[/math]
Rozwiązanie

Niech

[math]\displaystyle{ \alpha = {\small\frac{P + \sqrt{D}}{2}} \qquad \qquad \;\; \beta = {\small\frac{P - \sqrt{D}}{2}} }[/math]
[math]\displaystyle{ a = P + \sqrt{D} \qquad \qquad \;\; b = P - \sqrt{D} }[/math]

Liczby [math]\displaystyle{ \alpha, \beta }[/math] oraz [math]\displaystyle{ a, b }[/math] są odpowiednio pierwiastkami równań

[math]\displaystyle{ x^2 - P x + Q = 0 }[/math]
[math]\displaystyle{ x^2 - 2 P x + 4 Q = 0 }[/math]

Zatem definiują one ciągi Lucasa

[math]\displaystyle{ U_n (P, Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad \;\;\; V_n (P, Q) = \alpha^n + \beta^n }[/math]
[math]\displaystyle{ U_n (2 P, 4 Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (2 P, 4 Q) = a^n + b^n }[/math]

Zauważmy, że

[math]\displaystyle{ \alpha - \beta = \sqrt{D} }[/math]
[math]\displaystyle{ a - b = 2 \sqrt{D} }[/math]
[math]\displaystyle{ {\small\frac{a}{\alpha}} = {\small\frac{b}{\beta}} = 2 }[/math]

Łatwo znajdujemy

[math]\displaystyle{ U_n (2 P, 4 Q) = {\small\frac{a^n - b^n}{a - b}} = {\small\frac{(2 \alpha)^n - (2 \beta)^n}{2 \sqrt{D}}} = 2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} = 2^{n - 1} U_n (P, Q) }[/math]
[math]\displaystyle{ V_n (2 P, 4 Q) = a^n + b^n = (2 \alpha)^n + (2 \beta)^n = 2^n (\alpha^n + \beta^n) = 2^n V_n (P, Q) }[/math]

Co należało pokazać.


Zadanie M11
Pokazać, że jeżeli [math]\displaystyle{ Q \in \mathbb{Z} \setminus \{ 0 \} }[/math] oraz [math]\displaystyle{ P = 4 Q - 1 }[/math], to

[math]\displaystyle{ U_{2 k} (P, P Q) = - (- P)^k U_{2 k} (1, Q) }[/math]
[math]\displaystyle{ U_{2 k + 1} (P, P Q) = (- P)^k V_{2 k + 1} (1, Q) }[/math]
[math]\displaystyle{ V_{2 k} (P, P Q) = (- P)^k V_{2 k} (1, Q) }[/math]
[math]\displaystyle{ V_{2 k + 1} (P, P Q) = - (- P)^{k + 1} U_{2 k + 1} (1, Q) }[/math]
Rozwiązanie

Niech

[math]\displaystyle{ \alpha = {\small\frac{1 + \sqrt{- P}}{2}} \qquad \qquad \beta = {\small\frac{1 - \sqrt{- P}}{2}} }[/math]
[math]\displaystyle{ a = {\small\frac{P + \sqrt{- P}}{2}} \qquad \qquad b = {\small\frac{P - \sqrt{- P}}{2}} }[/math]

Liczby [math]\displaystyle{ \alpha, \beta }[/math] oraz [math]\displaystyle{ a, b }[/math] są odpowiednio pierwiastkami równań

[math]\displaystyle{ x^2 - x + {\small\frac{P + 1}{4}} = 0 }[/math]
[math]\displaystyle{ x^2 - P x + {\small\frac{P (P + 1)}{4}} = 0 }[/math]

Z założenia [math]\displaystyle{ P = 4 Q - 1 }[/math], zatem

[math]\displaystyle{ x^2 - x + Q = 0 }[/math]
[math]\displaystyle{ x^2 - P x + P Q = 0 }[/math]

Czyli definiują one ciągi Lucasa

[math]\displaystyle{ U_n (1, Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad \:\:\: V_n (1, Q) = \alpha^n + \beta^n }[/math]
[math]\displaystyle{ U_n (P, P Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (P, P Q) = a^n + b^n }[/math]

Zauważmy, że

[math]\displaystyle{ \alpha - \beta = a - b = \sqrt{- P} }[/math]
[math]\displaystyle{ {\small\frac{a}{\beta}} = {\small\frac{P + \sqrt{- P}}{1 - \sqrt{- P}}} = \sqrt{- P} }[/math]
[math]\displaystyle{ {\small\frac{b}{\alpha}} = {\small\frac{P - \sqrt{- P}}{1 + \sqrt{- P}}} = - \sqrt{- P} }[/math]


Łatwo znajdujemy

[math]\displaystyle{ U_{2 k} (P, P Q) = \frac{a^{2 k} - b^{2 k}}{a - b} = \frac{\left( \beta \sqrt{- P} \right)^{2 k} - \left( - \alpha \sqrt{- P} \right)^{2 k}}{\sqrt{- P}} = \frac{(- P)^k (\beta^{2 k} - \alpha^{2 k})}{\alpha - \beta} = - (- P)^k U_{2 k} (1, Q) }[/math]


[math]\displaystyle{ U_{2 k + 1} (P, P Q) = \frac{a^{2 k + 1} - b^{2 k + 1}}{a - b} = \frac{\left( \beta \sqrt{- P} \right)^{2 k + 1} - \left( - \alpha \sqrt{- P} \right)^{2 k + 1}}{\sqrt{- P}} = (- P)^k (\beta^{2 k + 1} + \alpha^{2 k + 1}) = (- P)^k V_{2 k + 1} (1, Q) }[/math]


[math]\displaystyle{ V_{2 k} (P, P Q) = a^{2 k} + b^{2 k} = \left( \beta \sqrt{- P} \right)^{2 k} + \left( - \alpha \sqrt{- P} \right)^{2 k} = (- P)^k (\alpha^{2 k} + \beta^{2 k}) = (- P)^k V_{2 k} (1, Q) }[/math]


[math]\displaystyle{ V_{2 k + 1} (P, P Q) = a^{2 k + 1} + b^{2 k + 1} = \left( \beta \sqrt{- P} \right)^{2 k + 1} + \left( - \alpha \sqrt{- P} \right)^{2 k + 1} = (- P)^{k + 1} \cdot \frac{\beta^{2 k + 1} - \alpha^{2 k + 1}}{\sqrt{- P}} = - (- P)^{k + 1} U_{2 k + 1} (1, Q) }[/math]

Co należało pokazać.


Zadanie M12
Pokazać, że jeżeli [math]\displaystyle{ Q \in \mathbb{Z} \setminus \{ 0 \} }[/math] oraz [math]\displaystyle{ P = 4 Q + 1 }[/math], to

[math]\displaystyle{ U_{2 k} (P, P Q) = P^k U_{2 k} (1, - Q) }[/math]
[math]\displaystyle{ U_{2 k + 1} (P, P Q) = P^k V_{2 k + 1} (1, - Q) }[/math]
[math]\displaystyle{ V_{2 k} (P, P Q) = P^k V_{2 k} (1, - Q) }[/math]
[math]\displaystyle{ V_{2 k + 1} (P, P Q) = P^{k + 1} U_{2 k + 1} (1, - Q) }[/math]
Rozwiązanie

Niech

[math]\displaystyle{ \alpha = {\small\frac{1 + \sqrt{P}}{2}} \qquad \qquad \beta = {\small\frac{1 - \sqrt{P}}{2}} }[/math]
[math]\displaystyle{ a = {\small\frac{P + \sqrt{P}}{2}} \qquad \qquad b = {\small\frac{P - \sqrt{P}}{2}} }[/math]

Liczby [math]\displaystyle{ \alpha, \beta }[/math] oraz [math]\displaystyle{ a, b }[/math] są odpowiednio pierwiastkami równań

[math]\displaystyle{ x^2 - x - {\small\frac{P - 1}{4}} = 0 }[/math]
[math]\displaystyle{ x^2 - P x + {\small\frac{P (P - 1)}{4}} = 0 }[/math]

Z założenia [math]\displaystyle{ P = 4 Q + 1 }[/math], zatem

[math]\displaystyle{ x^2 - x - Q = 0 }[/math]
[math]\displaystyle{ x^2 - P x + P Q = 0 }[/math]

Czyli definiują one ciągi Lucasa

[math]\displaystyle{ U_n (1, - Q) = {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \qquad \qquad V_n (1, - Q) = \alpha^n + \beta^n }[/math]
[math]\displaystyle{ U_n (P, P Q) = {\small\frac{a^n - b^n}{a - b}} \qquad \qquad V_n (P, P Q) = a^n + b^n }[/math]

Zauważmy, że

[math]\displaystyle{ \alpha - \beta = a - b = \sqrt{P} }[/math]
[math]\displaystyle{ {\small\frac{a}{\alpha}} = {\small\frac{P + \sqrt{P}}{1 + \sqrt{P}}} = \sqrt{P} }[/math]
[math]\displaystyle{ {\small\frac{b}{\beta}} = {\small\frac{P - \sqrt{P}}{1 - \sqrt{P}}} = - \sqrt{P} }[/math]


Łatwo znajdujemy

[math]\displaystyle{ U_{2 k} (P, P Q) = \frac{a^{2 k} - b^{2 k}}{a - b} = \frac{\left( \alpha \sqrt{P} \right)^{2 k} - \left( - \beta \sqrt{P} \right)^{2 k}}{\sqrt{P}} = \frac{P^k (\alpha^{2 k} - \beta^{2 k})}{\alpha - \beta} = P^k U_{2 k} (1, - Q) }[/math]


[math]\displaystyle{ U_{2 k + 1} (P, P Q) = \frac{a^{2 k + 1} - b^{2 k + 1}}{a - b} = \frac{\left( \alpha \sqrt{P} \right)^{2 k + 1} - \left( - \beta \sqrt{P} \right)^{2 k + 1}}{\sqrt{P}} = P^k (\alpha^{2 k + 1} + \beta^{2 k + 1}) = P^k V_{2 k + 1} (1, - Q) }[/math]


[math]\displaystyle{ V_{2 k} (P, P Q) = a^{2 k} + b^{2 k} = \left( \alpha \sqrt{P} \right)^{2 k} + \left( - \beta \sqrt{P} \right)^{2 k} = P^k (\alpha^{2 k} + \beta^{2 k}) = P^k V_{2 k} (1, - Q) }[/math]


[math]\displaystyle{ V_{2 k + 1} (P, P Q) = a^{2 k + 1} + b^{2 k + 1} = \left( \alpha \sqrt{P} \right)^{2 k + 1} + \left( - \beta \sqrt{P} \right)^{2 k + 1} = P^{k + 1} \cdot \frac{\alpha^{2 k + 1} - \beta^{2 k + 1}}{\sqrt{P}} = P^{k + 1} U_{2 k + 1} (1, - Q) }[/math]

Co należało pokazać.


Twierdzenie M13
Dla wyrazów ciągów Lucasa prawdziwe są wzory

Dowód

Wzory 1. - 7. najłatwiej udowodnić korzystając z definicji M1.

Wzór 1.

[math]\displaystyle{ U_{m + n} = {\small\frac{\alpha^{m + n} - \beta^{m + n}}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \quad \: = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot {\small\frac{\alpha^{n + 1} - \beta^{n + 1}}{\alpha - \beta}} - \alpha \beta \cdot {\small\frac{\alpha^{m - 1} - \beta^{m - 1}}{\alpha - \beta}} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \quad \: = U_m U_{n + 1} - Q U_{m - 1} U_n }[/math]


Wzór 2.

[math]\displaystyle{ V_{m + n} = \alpha^{m + n} + \beta^{m + n} }[/math]
[math]\displaystyle{ \quad \;\! = (\alpha^m + \beta^m) (\alpha^n + \beta^n) - \alpha^n \beta^n \cdot (\alpha^{m - n} + \beta^{m - n}) }[/math]
[math]\displaystyle{ \quad \;\! = V_m V_n - Q^n V_{m - n} }[/math]


Wzór 3.

[math]\displaystyle{ U_{m + n} = {\small\frac{\alpha^{m + n} - \beta^{m + n}}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \quad \: = {\small\frac{(\alpha^m - \beta^m) (\alpha^n + \beta^n)}{\alpha - \beta}} - {\small\frac{\alpha^n \beta^n \cdot (\alpha^{m - n} - \beta^{m - n})}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \quad \: = U_m V_n - Q^n U_{m - n} }[/math]


Wzór 4.

[math]\displaystyle{ V_{m + n} = \alpha^{m + n} + \beta^{m + n} }[/math]
[math]\displaystyle{ \quad \;\! = (\alpha - \beta)^2 \cdot {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} + \alpha^n \beta^n \cdot (\alpha^{m - n} + \beta^{m - n}) }[/math]
[math]\displaystyle{ \quad \;\! = D U_m U_n + Q^n V_{m - n} }[/math]


Wzór 5.

[math]\displaystyle{ U_m V_n - V_m U_n = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} \cdot (\alpha^n + \beta^n) - (\alpha^m + \beta^m) \cdot {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \;\;\: = 2 \cdot \alpha^n \beta^n \cdot {\small\frac{\alpha^{m - n} - \beta^{m - n}}{\alpha - \beta}} }[/math]
[math]\displaystyle{ \;\;\: = 2 Q^n U_{m - n} }[/math]


Wzór 6.

[math]\displaystyle{ U^2_n = \left( {\small\frac{\alpha^n - \beta^n}{\alpha - \beta}} \right)^2 }[/math]
[math]\displaystyle{ \;\! = {\small\frac{\alpha^{n - 1} - \beta^{n - 1}}{\alpha - \beta}} \cdot {\small\frac{\alpha^{n + 1} - \beta^{n + 1}}{\alpha - \beta}} + \alpha^{n - 1} \beta^{n - 1} }[/math]
[math]\displaystyle{ \;\! = U_{n - 1} U_{n + 1} + Q^{n - 1} }[/math]


Wzór 7.

[math]\displaystyle{ V^2_n = (\alpha^n + \beta^n)^2 }[/math]
[math]\displaystyle{ \;\! = (\alpha^{n - 1} + \beta^{n - 1}) (\alpha^{n + 1} + \beta^{n + 1}) - (\alpha - \beta)^2 \cdot \alpha^{n - 1} \beta^{n - 1} }[/math]
[math]\displaystyle{ \;\! = V_{n - 1} V_{n + 1} - D Q^{n - 1} }[/math]


Wzory 8. - 18. można łatwo udowodnić, korzystając ze wzorów 1. - 7.

Wzór 8. Policzyć sumę wzoru 3. pomnożonego przez [math]\displaystyle{ 2 }[/math] i wzoru 5.

Wzór 9. Policzyć sumę wzorów 2. i 4.

Wzór 10. Połączyć wzory 2. i 4.

Wzór 11. We wzorze 3. położyć [math]\displaystyle{ m = n }[/math].

Wzór 12. We wzorze 2. położyć [math]\displaystyle{ m = n }[/math].

Wzór 13. We wzorze 4. położyć [math]\displaystyle{ m = n }[/math].

Wzór 14. We wzorze 10. położyć [math]\displaystyle{ m = n }[/math] lub połączyć wzory 12. i 13.

Wzór 15. We wzorze 9. położyć [math]\displaystyle{ m = 1 }[/math].

Wzór 16. We wzorze 8. położyć [math]\displaystyle{ m = 1 }[/math].

Wzór 17. We wzorze 15. położyć [math]\displaystyle{ V_{n + 1} = P V_n - Q V_{n - 1} }[/math].

Wzór 18. We wzorze 16. położyć [math]\displaystyle{ U_{n + 1} = P U_n - Q U_{n - 1} }[/math].


Wzory 19. - 21. to wzory, które wykorzystamy w przyszłości do szybkiego obliczania wartości wyrazów [math]\displaystyle{ U_n }[/math] i [math]\displaystyle{ V_n }[/math] modulo.

Wzór 19. Wystarczy połączyć wzory 11. oraz 16.

Wzór 20. Wystarczy we wzorze 1. położyć [math]\displaystyle{ m = n + 1 }[/math].

Wzór 21. Kładąc we wzorze 19. [math]\displaystyle{ n \rightarrow n + 1 }[/math], otrzymujemy

[math]\displaystyle{ U_{2 n + 2} = 2 U_{n + 1} U_{n + 2} - P U^2_{n + 1} \qquad (*) }[/math]

Kładąc we wzorze 1. [math]\displaystyle{ m = n + 2 }[/math], mamy

[math]\displaystyle{ U_{2 n + 2} = U_{n + 2} U_{n + 1} - Q U_{n + 1} U_n }[/math]

Czyli

[math]\displaystyle{ 2 U_{2 n + 2} = 2 U_{n + 1} U_{n + 2} - 2 Q U_n U_{n + 1} }[/math]

Odejmując od powyższego wzoru wzór [math]\displaystyle{ (*) }[/math], dostajemy wzór 21.

[math]\displaystyle{ U_{2 n + 2} = P U^2_{n + 1} - 2 Q U_n U_{n + 1} }[/math]

Co należało pokazać.



Obliczanie wyrazów ciągu Lucasa modulo [math]\displaystyle{ m }[/math]

Przykład M14
Pokażemy, jak wykorzystać podane w twierdzeniu M13 wzory 19, 20, 21 i 16

[math]\displaystyle{ U_{2 n} = 2 U_n U_{n + 1} - P U^2_n }[/math]
[math]\displaystyle{ U_{2 n + 1} = U^2_{n + 1} - Q U^2_n }[/math]
[math]\displaystyle{ U_{2 n + 2} = P U^2_{n + 1} - 2 Q U_n U_{n + 1} }[/math]
[math]\displaystyle{ V_n = 2 U_{n + 1} - P U_n }[/math]

do szybkiego obliczania wyrazów ciągu Lucasa modulo [math]\displaystyle{ m }[/math].


Niech [math]\displaystyle{ P = 3 }[/math], [math]\displaystyle{ Q = 1 }[/math], [math]\displaystyle{ D = P^2 - 4 Q = 5 }[/math], [math]\displaystyle{ n = 22 = (10110)_2 = \sum_{j = 0}^{4} a_j \cdot 2^j }[/math].

W tabeli przedstawione są kolejne kroki, jakie musimy wykonać, aby policzyć [math]\displaystyle{ U_n = U_{22} }[/math] modulo [math]\displaystyle{ m = 23 }[/math].

W kolumnie [math]\displaystyle{ a_j }[/math] wypisujemy kolejne cyfry liczby [math]\displaystyle{ n = 22 = (10110)_2 }[/math] zapisanej w układzie dwójkowym. Liczby w kolumnie [math]\displaystyle{ k_j }[/math] tworzymy, biorąc kolejne (od prawej do lewej) cyfry liczby [math]\displaystyle{ n }[/math] w zapisie dwójkowym. Postępując w ten sposób, w ostatnim wierszu mamy [math]\displaystyle{ k_j = n }[/math] i wyliczamy liczby [math]\displaystyle{ U_n }[/math] i [math]\displaystyle{ U_{n + 1} }[/math] modulo [math]\displaystyle{ m }[/math].

Dla uproszczenia zapisu i ułatwienia zrozumienia liczbę [math]\displaystyle{ k_j }[/math] oznaczymy jako [math]\displaystyle{ r }[/math], a [math]\displaystyle{ k_{j + 1} }[/math] jako [math]\displaystyle{ s }[/math]. Zauważmy, że

  • tabela jest zbudowana tak, że musimy znaleźć wyrazy ciągu Lucasa o indeksie [math]\displaystyle{ r = k_j }[/math] oraz o indeksie o jeden większym: [math]\displaystyle{ r + 1 = k_j + 1 }[/math]
  • przejście do następnego wiersza (w dół) oznacza, że musimy znaleźć wyrazy o indeksie [math]\displaystyle{ s = k_{j + 1} }[/math] oraz o indeksie o jeden większym: [math]\displaystyle{ s + 1 }[/math]
  • przechodząc do następnego wiersza, dotychczasowa liczba [math]\displaystyle{ r = k_j }[/math] powiększa się o kolejną cyfrę ( [math]\displaystyle{ 0 }[/math] lub [math]\displaystyle{ 1 }[/math] ), którą dopisujemy z prawej strony
  • dodanie na końcu liczby [math]\displaystyle{ r = k_j }[/math] zera podwaja liczbę [math]\displaystyle{ r }[/math], czyli [math]\displaystyle{ s = k_{j + 1} = 2 r }[/math] oraz [math]\displaystyle{ s + 1 = 2 r + 1 }[/math]
  • dodanie na końcu liczby [math]\displaystyle{ r = k_j }[/math] jedynki podwaja liczbę [math]\displaystyle{ r }[/math] i zwiększą ją o jeden, czyli [math]\displaystyle{ s = k_{j + 1} = 2 r + 1 }[/math] oraz [math]\displaystyle{ s + 1 = 2 r + 2 }[/math]


Dlatego, jeżeli kolejną dodaną cyfrą jest zero, to korzystamy ze wzorów

[math]\displaystyle{ U_s = U_{2 r} = 2 U_r U_{r + 1} - P U^2_r }[/math]
[math]\displaystyle{ U_{s + 1} = U_{2 r + 1} = U^2_{r + 1} - Q U^2_r }[/math]

Gdy kolejną dodaną cyfrą jest jeden, to stosujemy wzory

[math]\displaystyle{ U_s = U_{2 r + 1} = U^2_{r + 1} - Q U^2_r }[/math]
[math]\displaystyle{ U_{s + 1} = U_{2 r + 2} = P U^2_{r + 1} - 2 Q U_r U_{r + 1} }[/math]


Korzystając ze wzoru [math]\displaystyle{ V_n = 2 U_{n + 1} - P U_n }[/math], mamy

[math]\displaystyle{ V_{22} = 2 U_{23} - 3 U_{22} \equiv 44 - 60 \equiv - 16 \equiv 7 \pmod{23} }[/math]

Ostatecznie otrzymujemy

[math]\displaystyle{ U_{22} \equiv 20 \pmod{23} \quad }[/math] oraz [math]\displaystyle{ \quad V_{22} \equiv 7 \pmod{23} }[/math]


Uwaga M15
Uogólniając postępowanie przedstawione w przykładzie M14, możemy napisać program w PARI/GP do szybkiego obliczania wyrazów ciągu Lucasa [math]\displaystyle{ U_n (P, Q) }[/math] i [math]\displaystyle{ V_n (P, Q) }[/math] modulo [math]\displaystyle{ m }[/math].

modLucas(n, P, Q, m) =
{
local(A, i, s, U, U2, V, W, W2);
if( m == 1, return([0, 0]) );
if( n == 0, return([0, 2 % m]) );
A = digits(n, 2); \\ otrzymujemy wektor cyfr liczby n w układzie dwójkowym
s = length(A); \\ długość wektora A
U = 1;
W = P;
i = 1;
while( i++ <= s,
       if( A[i] == 0,  U2 = 2*U*W - P*U^2;  W2 = W^2 - Q*U^2 );
       if( A[i] == 1,  U2 = W^2 - Q*U^2;  W2 = P*W^2 - 2*Q*U*W );
       U = U2 % m;
       W = W2 % m;
     );
V = (2*W - P*U) % m;
return([U, V]);
}



Podzielność wyrazów [math]\displaystyle{ U_n (P, Q) }[/math] przez liczbę pierwszą nieparzystą

Uwaga M16
Niech [math]\displaystyle{ p }[/math] będzie liczbą pierwszą nieparzystą. W przypadku, gdy [math]\displaystyle{ p \nmid P Q }[/math] nie możemy nic powiedzieć o podzielności wyrazów [math]\displaystyle{ U_n }[/math] przez [math]\displaystyle{ p }[/math]. Przykładowo, jeżeli [math]\displaystyle{ P \equiv 1 \pmod{p} \; }[/math] [math]\displaystyle{ \text{i} \;\; Q \equiv 1 \pmod{p} }[/math], to modulo [math]\displaystyle{ p }[/math], mamy

[math]\displaystyle{ (U_n) \equiv (0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, \ldots) }[/math]

W przypadku, gdy [math]\displaystyle{ P \equiv 2 \pmod{p} \; }[/math] [math]\displaystyle{ \text{i} \;\; Q \equiv 1 \pmod{p} }[/math], to modulo [math]\displaystyle{ p }[/math] mamy

[math]\displaystyle{ (U_n) \equiv (0, 1, 2, \ldots, p - 1, 0, 1, 2, \ldots, p - 1, 0, 1, 2, \ldots, p - 1, \ldots) }[/math]

Sytuacja wygląda inaczej, gdy [math]\displaystyle{ p \mid P Q }[/math].


Twierdzenie M17
Niech [math]\displaystyle{ p }[/math] będzie liczbą pierwszą nieparzystą.

●    jeżeli [math]\displaystyle{ \; p \mid P \; }[/math] [math]\displaystyle{ \text{i} \;\; p \mid Q , \; }[/math] to [math]\displaystyle{ \; p \mid U_n \; }[/math] dla [math]\displaystyle{ n \geqslant 2 }[/math]
●    jeżeli [math]\displaystyle{ \; p \mid P \; }[/math] [math]\displaystyle{ \text{i} \;\; p \nmid Q , \; }[/math] to [math]\displaystyle{ \; p \mid U_{2 n} \; }[/math] i [math]\displaystyle{ \; p \nmid U_{2 n + 1} }[/math]
●    jeżeli [math]\displaystyle{ \; p \nmid P \; }[/math] [math]\displaystyle{ \text{i} \;\; p \mid Q , \; }[/math] to [math]\displaystyle{ \; p \nmid U_n \; }[/math] dla [math]\displaystyle{ n \geqslant 1 }[/math]
●    jeżeli [math]\displaystyle{ \; p \mid Q , \; }[/math] to [math]\displaystyle{ \; p \mid U_n }[/math], gdzie [math]\displaystyle{ n \geqslant 2 }[/math], wtedy i tylko wtedy, gdy [math]\displaystyle{ \; p \mid P }[/math]
●    jeżeli [math]\displaystyle{ \; p \nmid P \; }[/math] [math]\displaystyle{ \text{i} \;\; p \mid D , \; }[/math] to [math]\displaystyle{ \; p \mid U_n \; }[/math] wtedy i tylko wtedy, gdy [math]\displaystyle{ p \mid n }[/math]

Założenie, że [math]\displaystyle{ p \nmid P }[/math] w ostatnim punkcie jest istotne. Gdy [math]\displaystyle{ \; p \mid P \; }[/math] i [math]\displaystyle{ \; p \mid D , \; }[/math] to [math]\displaystyle{ \; p \mid Q \; }[/math] i otrzymujemy punkt pierwszy.

Dowód

Punkt 1.

Ponieważ [math]\displaystyle{ U_2 = P }[/math], zatem [math]\displaystyle{ p \mid U_2 }[/math]. Dla [math]\displaystyle{ n \geqslant 3 }[/math] wyrażenie [math]\displaystyle{ U_n = P U_{n - 1} - Q U_{n - 2} }[/math] jest podzielne przez [math]\displaystyle{ p }[/math].

Punkt 2.

Indeksy parzyste. Indukcja matematyczna. Mamy [math]\displaystyle{ U_0 = 0 }[/math] i [math]\displaystyle{ U_2 = P }[/math], zatem [math]\displaystyle{ p \mid U_0 }[/math] i [math]\displaystyle{ p \mid U_2 }[/math]. Zakładając, że [math]\displaystyle{ p \mid U_{2 n} }[/math], z definicji ciągu [math]\displaystyle{ (U_k) }[/math], otrzymujemy dla [math]\displaystyle{ U_{2 n + 2} }[/math]

[math]\displaystyle{ U_{2 n + 2} = P U_{2 n - 1} - Q U_{2 n} }[/math]

Z założenia indukcyjnego wynika, że [math]\displaystyle{ p \mid U_{2 n + 2} }[/math], zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich [math]\displaystyle{ n \geqslant 0 }[/math].

Indeksy nieparzyste. Indukcja matematyczna. Mamy [math]\displaystyle{ U_1 = 1 }[/math] i [math]\displaystyle{ U_3 = P^2 - Q }[/math], zatem [math]\displaystyle{ p \nmid U_1 }[/math] i [math]\displaystyle{ p \nmid U_3 }[/math]. Zakładając, że [math]\displaystyle{ p \nmid U_{2 n - 1} }[/math], z definicji ciągu [math]\displaystyle{ (U_k) }[/math], otrzymujemy dla [math]\displaystyle{ U_{2 n + 1} }[/math]

[math]\displaystyle{ U_{2 n + 1} = P U_{2 n} - Q U_{2 n - 1} }[/math]

Z założenia indukcyjnego wynika, że [math]\displaystyle{ p \nmid U_{2 n + 1} }[/math], zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich [math]\displaystyle{ n \geqslant 1 }[/math].

Punkt 3.

Indukcja matematyczna. Mamy [math]\displaystyle{ U_1 = 1 }[/math] i [math]\displaystyle{ U_2 = P }[/math], zatem [math]\displaystyle{ p \nmid U_1 }[/math] i [math]\displaystyle{ p \nmid U_2 }[/math]. Zakładając, że [math]\displaystyle{ p \nmid U_n }[/math] zachodzi dla wszystkich liczb całkowitych dodatnich nie większych od [math]\displaystyle{ n }[/math], z definicji ciągu [math]\displaystyle{ (U_n) }[/math] otrzymujemy dla [math]\displaystyle{ n + 1 }[/math]

[math]\displaystyle{ U_{n + 1} = P U_n - Q U_{n - 1} }[/math]

Z założenia indukcyjnego wynika, że [math]\displaystyle{ p \nmid U_{n + 1} }[/math], zatem na mocy zasady indukcji matematycznej twierdzenie jest prawdziwe dla wszystkich liczb [math]\displaystyle{ n \geqslant 1 }[/math].

Punkt 4.

Wynika z punktów pierwszego i trzeciego.

Punkt 5.

Z twierdzenia M7 wiemy, że

[math]\displaystyle{ 2^{n - 1} U_n = \sum_{k = 0}^{\lfloor (n - 1) / 2 \rfloor} \binom{n}{2 k + 1} P^{n - 2 k - 1} D^k }[/math]
[math]\displaystyle{ \;\; = n P^{n - 1} + \binom{n}{3} P^{n - 3} D + \binom{n}{5} P^{n - 5} D^2 + \ldots + \begin{cases} n P D^{(n - 2) / 2} & \text{gdy }n\text{ jest parzyste} \\ D^{(n - 1) / 2} & \text{gdy }n\text{ jest nieparzyste} \end{cases} }[/math]

Z założenia [math]\displaystyle{ p \mid D }[/math], zatem modulo [math]\displaystyle{ p }[/math] dostajemy

[math]\displaystyle{ 2^{n - 1} U_n \equiv n P^{n - 1} \pmod{p} }[/math]

Ponieważ [math]\displaystyle{ p \nmid P }[/math], zatem [math]\displaystyle{ p \mid U_n }[/math] wtedy i tylko wtedy, gdy [math]\displaystyle{ p \mid n }[/math]. Co należało pokazać.


Twierdzenie M18
Jeżeli [math]\displaystyle{ d }[/math] jest nieparzystym dzielnikiem [math]\displaystyle{ Q }[/math], to dla [math]\displaystyle{ n \geqslant 2 }[/math] jest

[math]\displaystyle{ U_n \equiv P^{n - 1} \pmod{d} }[/math]

W szczególności, gdy liczba pierwsza nieparzysta [math]\displaystyle{ p }[/math] jest dzielnikiem [math]\displaystyle{ Q }[/math] i [math]\displaystyle{ p \nmid P }[/math], to

[math]\displaystyle{ U_p \equiv 1 \pmod{p} }[/math]
Dowód

Oznaczmy [math]\displaystyle{ \delta = \sqrt{D} }[/math], zatem [math]\displaystyle{ 2 \alpha = P + \delta }[/math] i [math]\displaystyle{ 2 \beta = P - \delta }[/math]. Ze wzoru dwumianowego, mamy

[math]\displaystyle{ 2^n \alpha^n = (P + \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} \delta^j }[/math]
[math]\displaystyle{ 2^n \beta^n = (P - \delta)^n = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (- \delta)^j }[/math]


Obliczając różnicę wyjściowych wzorów, mamy

[math]\displaystyle{ 2^n (\alpha^n - \beta^n) = \sum_{j = 0}^{n} \binom{n}{j} P^{n - j} (\delta^j - (- \delta)^j) = }[/math]
[math]\displaystyle{ \quad \: = \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot 2 \delta^j }[/math]
[math]\displaystyle{ \quad \: = 2 \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot \delta \cdot D^{(j - 1) / 2} }[/math]

Rozpatrując powyższą równość modulo [math]\displaystyle{ Q }[/math] dostajemy (zobacz M43)

[math]\displaystyle{ 2^{n - 1} \cdot {\small\frac{\alpha^n - \beta^n}{\delta}} = 2^{n - 1} U_n \equiv \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} P^{n - j} \cdot P^{j - 1} }[/math]
[math]\displaystyle{ \;\:\: \equiv P^{n - 1} \underset{j \; \text{nieparzyste}}{\sum_{j = 1}^{n}} \binom{n}{j} }[/math]
[math]\displaystyle{ \;\:\: \equiv 2^{n - 1} P^{n - 1} }[/math]

Czyli

[math]\displaystyle{ 2^{n - 1} (U_n - P^{n - 1}) \equiv 0 \pmod{Q} }[/math]

Ponieważ [math]\displaystyle{ Q }[/math] dzieli [math]\displaystyle{ 2^{n - 1} (U_n - P^{n - 1}) }[/math], to tym bardziej [math]\displaystyle{ d }[/math] dzieli [math]\displaystyle{ 2^{n - 1} (U_n - P^{n - 1}) }[/math]. Z założenia [math]\displaystyle{ \gcd (d, 2^{n - 1}) = 1 }[/math], zatem [math]\displaystyle{ d }[/math] dzieli [math]\displaystyle{ U_n - P^{n - 1} }[/math] (zobacz C74).

W przypadku szczególnym, gdy [math]\displaystyle{ d = p }[/math], gdzie [math]\displaystyle{ p }[/math] jest nieparzystą liczbą pierwszą i [math]\displaystyle{ p \nmid P }[/math], z twierdzenia Fermata otrzymujemy natychmiast

[math]\displaystyle{ U_p \equiv P^{p - 1} \equiv 1 \pmod{p} }[/math]

Co należało pokazać.


Twierdzenie M19
Niech [math]\displaystyle{ D = P^2 - 4 Q }[/math], a [math]\displaystyle{ (D \mid p) }[/math] oznacza symbol Legendre'a, gdzie [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą i [math]\displaystyle{ p \nmid Q }[/math]. Mamy

●    [math]\displaystyle{ U_p \equiv (D \mid p) \pmod{p} }[/math]
●    jeżeli [math]\displaystyle{ (D \mid p) = - 1 , \; }[/math] to [math]\displaystyle{ \; p \mid U_{p + 1} }[/math]
●    jeżeli [math]\displaystyle{ (D \mid p) = 1 , \; }[/math] to [math]\displaystyle{ \; p \mid U_{p - 1} }[/math]
Dowód

Punkt 1.

Zauważmy, że przypadek gdy [math]\displaystyle{ p \mid Q }[/math], omówiliśmy w twierdzeniu poprzednim. Z założenia [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą. Z twierdzenia M7, w przypadku nieparzystego [math]\displaystyle{ n = p }[/math], otrzymujemy

[math]\displaystyle{ 2^{p - 1} U_p = p P^{p - 1} + \binom{p}{3} P^{p - 3} D + \binom{p}{5} P^{p - 5} D^2 + \ldots + \binom{p}{p-2} P^2 D^{(p - 3) / 2} + D^{(p - 1) / 2} }[/math]

Ponieważ dla każdego [math]\displaystyle{ k \in [1, p - 1] }[/math] (zobacz M43)

[math]\displaystyle{ \binom{p}{k} \equiv 0 \pmod{p} }[/math]

to modulo [math]\displaystyle{ p }[/math] dostajemy (zobacz J30)

[math]\displaystyle{ 2^{p - 1} U_p \equiv U_p \equiv D^{(p - 1) / 2} \equiv (D \mid p) \pmod{p} }[/math]

Punkt 2.

Zauważmy, że warunek [math]\displaystyle{ (D \mid p) = - 1 }[/math] nie może być spełniony, gdy [math]\displaystyle{ p \mid Q }[/math]. Istotnie, gdy [math]\displaystyle{ p \mid Q }[/math], to [math]\displaystyle{ D = P^2 - 4 Q \equiv P^2 \pmod{p} }[/math], czyli

[math]\displaystyle{ (D \mid p) = (P^2 \mid p) = (P \mid p)^2 = 0 , \; }[/math] gdy [math]\displaystyle{ p \mid P }[/math]

lub

[math]\displaystyle{ (D \mid p) = (P^2 \mid p) = (P \mid p)^2 = 1 , \; }[/math] gdy [math]\displaystyle{ p \nmid P }[/math]

i nie może być [math]\displaystyle{ (D \mid p) = - 1 }[/math].

Dla parzystego [math]\displaystyle{ n = p + 1 }[/math] otrzymujemy z twierdzenia M7

[math]\displaystyle{ 2^p U_{p + 1} = (p + 1) P^p + \binom{p + 1}{3} P^{p - 2} D + \binom{p + 1}{5} P^{p - 4} D^2 + \ldots + \binom{p + 1}{p - 2} P^3 D^{(p - 3) / 2} + (p + 1) P D^{(p - 1) / 2} }[/math]

Ponieważ dla [math]\displaystyle{ k \in [2, p - 1] }[/math] (zobacz M44)

[math]\displaystyle{ \binom{p + 1}{k} \equiv 0 \pmod{p} }[/math]

to modulo [math]\displaystyle{ p }[/math] dostajemy

[math]\displaystyle{ 2 U_{p + 1} \equiv P + P D^{(p - 1) / 2} \pmod{p} }[/math]


Z założenia [math]\displaystyle{ D }[/math] jest liczbą niekwadratową modulo [math]\displaystyle{ p }[/math], zatem [math]\displaystyle{ D^{(p - 1) / 2} \equiv - 1 \pmod{p} }[/math] (zobacz J28). Skąd wynika natychmiast, że

[math]\displaystyle{ 2 U_{p + 1} \equiv 0 \pmod{p} }[/math]

Czyli [math]\displaystyle{ p \mid U_{p + 1} }[/math].

Punkt 3.

Dla parzystego [math]\displaystyle{ n = p - 1 }[/math] otrzymujemy z twierdzenia M7

[math]\displaystyle{ 2^{p - 2} U_{p - 1} = (p - 1) P^{p - 2} + \binom{p - 1}{3} P^{p - 4} D + \binom{p - 1}{5} P^{p - 6} D^2 + \ldots + \binom{p - 1}{p - 4} P^3 D^{(p - 5) / 2} + (p - 1) P D^{(p - 3) / 2} }[/math]

Ponieważ dla [math]\displaystyle{ k \in [0, p - 1] }[/math] (zobacz M45)

[math]\displaystyle{ \binom{p - 1}{k} \equiv (- 1)^k \pmod{p} }[/math]

to modulo [math]\displaystyle{ p }[/math] mamy

[math]\displaystyle{ 2^{p - 2} U_{p - 1} \equiv - (P^{p - 2} + P^{p - 4} D + P^{p - 6} D^2 + \ldots + P D^{(p - 3) / 2}) \pmod{p} }[/math]
[math]\displaystyle{ \quad \,\, \equiv - P (P^{p - 3} + P^{p - 5} D + P^{p - 7} D^2 + \ldots + D^{(p - 3) / 2}) \pmod{p} }[/math]


Z założenia [math]\displaystyle{ D }[/math] jest liczbą kwadratową modulo [math]\displaystyle{ p }[/math] (zobacz J26), zatem istnieje taka liczba [math]\displaystyle{ R }[/math], że

[math]\displaystyle{ D \equiv R^2 \pmod{p} }[/math]

Ponieważ

  • [math]\displaystyle{ (D \mid p) = 1 }[/math], to [math]\displaystyle{ p \nmid D }[/math], zatem [math]\displaystyle{ p \nmid R }[/math]
  • z założenia [math]\displaystyle{ p \nmid Q }[/math], to [math]\displaystyle{ P^2 - R^2 \equiv P^2 - D \equiv 4 Q \not\equiv 0 \pmod{p} }[/math]


Czyli

[math]\displaystyle{ 2^{p - 2} U_{p - 1} \equiv - P (P^{p - 3} + P^{p - 5} R^2 + P^{p - 7} R^4 + \ldots + R^{p - 3}) \pmod{p} }[/math]


Uwzględniając, że [math]\displaystyle{ P^2 - R^2 \not\equiv 0 \pmod{p} }[/math], możemy napisać

[math]\displaystyle{ 2^{p - 2} (P^2 - R^2) U_{p - 1} \equiv - P (P^2 - R^2) (P^{p - 3} + P^{p - 5} R^2 + P^{p - 7} R^4 + \ldots + R^{p - 3}) \pmod{p} }[/math]
[math]\displaystyle{ \equiv - P (P^{p - 1} - R^{p - 1}) \pmod{p} }[/math]
[math]\displaystyle{ \equiv 0 \pmod{p} }[/math]

Zauważmy, że wynik nie zależy od tego, czy [math]\displaystyle{ p \mid P }[/math], czy [math]\displaystyle{ p \nmid P }[/math]. Skąd wynika

[math]\displaystyle{ U_{p - 1} \equiv 0 \pmod{p} }[/math]

Co należało pokazać.


Aby zapisać punkty 2. i 3. twierdzenia M19 (i tylko te punkty) w zwartej formie, musimy założyć, że [math]\displaystyle{ \gcd (p, D) = 1 }[/math]. Otrzymujemy
Twierdzenie M20
Jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą i [math]\displaystyle{ \gcd (p, Q D) = 1 }[/math], to

[math]\displaystyle{ U_{p - (D \mid p)} \equiv 0 \pmod{p} }[/math]



Liczby pseudopierwsze Lucasa

Uwaga M21
Z twierdzenia M20 wiemy, że liczby pierwsze nieparzyste [math]\displaystyle{ p }[/math] takie, że [math]\displaystyle{ p \nmid Q D }[/math] są dzielnikami wyrazów ciągu Lucasa [math]\displaystyle{ U_{p - (D \mid p)} }[/math], gdzie [math]\displaystyle{ (D \mid p) }[/math] oznacza symbol Legendre'a. Jeśli zastąpimy symbol Legendre'a symbolem Jacobiego, to będziemy mogli badać prawdziwość tego twierdzenia dla liczb złożonych i łatwo przekonamy się, że dla pewnych liczb złożonych [math]\displaystyle{ m }[/math] kongruencja

[math]\displaystyle{ U_{m - (D \mid m)} \equiv 0 \pmod{m} }[/math]

również jest prawdziwa. Prowadzi to definicji liczb pseudopierwszych Lucasa.


Definicja M22
Powiemy, że liczba złożona nieparzysta [math]\displaystyle{ m }[/math] jest liczbą pseudopierwszą Lucasa dla parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math] (symbolicznie: LPSP( [math]\displaystyle{ P, Q }[/math] )), jeżeli [math]\displaystyle{ \gcd (m, Q D) = 1 }[/math] i

[math]\displaystyle{ U_{m - (D \mid m)} \equiv 0 \pmod{m} }[/math]

gdzie [math]\displaystyle{ (D \mid m) }[/math] oznacza symbol Jacobiego.


Twierdzenie M23
Jeżeli liczba złożona nieparzysta [math]\displaystyle{ m }[/math] jest liczbą pseudopierwszą Lucasa dla parametrów [math]\displaystyle{ P = a + 1 }[/math] i [math]\displaystyle{ Q = a }[/math], gdzie [math]\displaystyle{ a \geqslant 2 }[/math], to jest liczbą pseudopierwszą Fermata przy podstawie [math]\displaystyle{ a }[/math].

Dowód

Połóżmy we wzorze definiującym ciąg Lucasa

[math]\displaystyle{ U_m = {\small\frac{\alpha^m - \beta^m}{\alpha - \beta}} }[/math]

[math]\displaystyle{ \alpha = a }[/math] i [math]\displaystyle{ \beta = 1 }[/math]. Odpowiada to parametrom [math]\displaystyle{ P = \alpha + \beta = a + 1 }[/math], [math]\displaystyle{ Q = \alpha \beta = a }[/math], [math]\displaystyle{ D = (\alpha - \beta)^2 = (a - 1)^2 }[/math].

Ponieważ musi być [math]\displaystyle{ \gcd (m, Q D) = 1 }[/math], to mamy [math]\displaystyle{ \gcd (m, (a - 1) a) = 1 }[/math] i wynika stąd, że [math]\displaystyle{ (D \mid m) = 1 }[/math]. Z założenia [math]\displaystyle{ m }[/math] jest liczbą pseudopierwszą Lucasa dla parametrów [math]\displaystyle{ P = a + 1 }[/math] i [math]\displaystyle{ Q = a }[/math], zatem

[math]\displaystyle{ U_{m - 1} (a + 1, a) \equiv 0 \pmod{m} }[/math]

Czyli

[math]\displaystyle{ {\small\frac{a^{m - 1} - 1}{a - 1}} \equiv 0 \pmod{m} }[/math]

Jeżeli [math]\displaystyle{ m \biggr\rvert {\small\frac{a^{m - 1} - 1}{a - 1}} }[/math], to tym bardziej [math]\displaystyle{ m \big\rvert (a^{m - 1} - 1) }[/math] i możemy napisać

[math]\displaystyle{ a^{m - 1} - 1 \equiv 0 \pmod{m} }[/math]

Zatem [math]\displaystyle{ m }[/math] jest liczbą pseudopierwszą Fermata przy podstawie [math]\displaystyle{ a }[/math]. Co należało pokazać.


Uwaga M24
Wykorzystując funkcje jacobi(a, n) i modLucas(n, P, Q, m) (zobacz J44, M15) możemy napisać prosty program, który sprawdza, czy dla liczby nieparzystej [math]\displaystyle{ m }[/math] prawdziwe jest twierdzenie M20.

isPrimeOrLPSP(m, P, Q) = 
{
local(D, js);
D = P^2 - 4*Q;
if( gcd(m, 2*Q*D) > 1, return(0) );
js = jacobi(D, m);
if( modLucas(m - js, P, Q, m)[1] == 0, return(1), return(0) );
}


Przykład M25
Poniższa tabela zawiera najmniejsze liczby pseudopierwsze Lucasa dla różnych parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math]

Pokaż kod
FirstLPSP(Stop) = 
\\ najmniejsze LPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
{
local(D, m, P, Q);
Q = -6;
while( Q++ <= 5,
       if( Q == 0, next() );
       P = 0;
       while( P++ <= 10,
              D = P^2 - 4*Q;
              if( D == 0, 
                  print("Q= ", Q, "   P= ", P, "   ------------------");
                  next();
                );
              m = 3;
              while( m < Stop,
                     if( isPrimeOrLPSP(m, P, Q)  &&  !isprime(m),
                         print("Q= ", Q, "   P= ", P, "   m= ", m, "   (D|m)= ", jacobi(D, m));
                         break();
                       );
                     m = m + 2;
                   );
            );
     );
}


Żółtym tłem oznaczyliśmy te najmniejsze liczby pseudopierwsze Lucasa, dla których [math]\displaystyle{ (D \mid m) = - 1 }[/math].


Przykład M26
Ilość liczb LPSP([math]\displaystyle{ P, Q }[/math]) mniejszych od [math]\displaystyle{ 10^9 }[/math]

Pokaż kod
NumOfLPSP(Stop) = 
\\ ilość liczb pseudopierwszych Lucasa LPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
{
local(D, m, P, Q);
Q = -6;
while( Q++ <= 5,
       if( Q == 0, next() );
       P = 0;
       while( P++ <= 10,
              D = P^2 - 4*Q;
              if( D == 0, print("Q= ", Q, "   P= ", P, "   ------------------"); next() );
              s = 0;
              m = 3;
              while( m < Stop,
                     if( isPrimeOrLPSP(m, P, Q)  &&  !isprime(m), s++ );
                     m = m + 2;
                   );
              print("Q= ", Q, "   P= ", P, "   s= ", s);
            );
     );
}



Uwaga M27
Dla [math]\displaystyle{ (P, Q) = (1, 1) }[/math] ciąg Lucasa [math]\displaystyle{ (U_n) }[/math] ma postać

[math]\displaystyle{ (U_n) = (0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, 1, \ldots) }[/math]

Stosując indukcję matematyczną, udowodnimy, że [math]\displaystyle{ U_{3 k} = 0 }[/math]. Łatwo sprawdzamy, że dla [math]\displaystyle{ k = 0 }[/math] i [math]\displaystyle{ k = 1 }[/math] wzór jest prawdziwy. Zakładając prawdziwość wzoru dla wszystkich liczb naturalnych nie większych od [math]\displaystyle{ k }[/math], otrzymujemy dla [math]\displaystyle{ k + 1 }[/math] (zobacz M13 p.3)

[math]\displaystyle{ U_{3 (k + 1)} = U_{3 k + 3} = U_{3 k} V_3 - U_{3 (k - 1)} = 0 }[/math]

Co kończy dowód. Zbadajmy liczby pseudopierwsze Lucasa dla [math]\displaystyle{ (P, Q) = (1, 1) }[/math].

Mamy [math]\displaystyle{ D = P^2 - 4 Q = - 3 }[/math]. Wynika stąd, że nie może być [math]\displaystyle{ 3 \mid m }[/math], bo mielibyśmy [math]\displaystyle{ \gcd (m, Q D) = 3 \gt 1 }[/math].

Z zadania J42 wiemy, że

[math]\displaystyle{ (- 3 \mid m) = \begin{cases} \;\;\: 1 & \text{gdy } m = 6 k + 1 \\ \;\;\: 0 & \text{gdy } m = 6 k + 3 \\ - 1 & \text{gdy } m = 6 k + 5 \end{cases} }[/math]

Ponieważ [math]\displaystyle{ 3 \nmid m }[/math], to wystarczy zbadać przypadki [math]\displaystyle{ m = 6 k + 1 }[/math] i [math]\displaystyle{ m = 6 k + 5 }[/math]. W pierwszym przypadku jest

[math]\displaystyle{ U_{m - (- 3 \mid m)} = U_{6 k + 1 - 1} = U_{6 k} = 0 }[/math]

W drugim przypadku, gdy [math]\displaystyle{ m = 6 k + 5 }[/math], dostajemy

[math]\displaystyle{ U_{m - (- 3 \mid m)} = U_{6 k + 5 + 1} = U_{6 (k + 1)} = 0 }[/math]

Zatem dla dowolnej liczby nieparzystej [math]\displaystyle{ m }[/math] niepodzielnej przez [math]\displaystyle{ 3 }[/math] jest

[math]\displaystyle{ U_{m - (- 3 \mid m)} \equiv 0 \pmod{m} }[/math]

Czyli liczbami pseudopierwszymi Lucasa dla parametrów [math]\displaystyle{ (P, Q) = (1, 1) }[/math] będą liczby nieparzyste [math]\displaystyle{ m }[/math], które nie są podzielne przez [math]\displaystyle{ 3 }[/math] i nie są liczbami pierwszymi. Ilość takich liczb nie większych od [math]\displaystyle{ 10^k }[/math] możemy łatwo znaleźć poleceniem

for(k = 1, 9, s = 0; forstep(m = 3, 10^k, 2, if( m%6 <> 3, s = s + !isprime(m) )); print(s))


Zadanie M28
Pokazać, że ilość liczb pseudopierwszych Lucasa dla parametrów [math]\displaystyle{ (P, Q) = (2, 2) }[/math] nie większych od [math]\displaystyle{ 10^k }[/math] możemy znaleźć poleceniem

for(k = 1, 9, s = 0; forstep(m = 3, 10^k, 2, s = s + !isprime(m)); print(s))



Metoda Selfridge'a wyboru parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math]

Uwaga M29
Twierdzenie M20 możemy wykorzystać do testowania pierwszości liczb. Ponieważ musi być spełniony warunek [math]\displaystyle{ \gcd (m, Q D) = 1 }[/math], to nie każda para liczb [math]\displaystyle{ P, Q }[/math] (np. wybrana losowo) nadaje się do przeprowadzenia testu. Zawsze będziemy zmuszeni określić zasadę postępowania, która doprowadzi do wyboru właściwej pary [math]\displaystyle{ P, Q }[/math].

Robert Baillie i Samuel Wagstaff przedstawili[1] dwie metody wyboru parametrów dla testu Lucasa. Ograniczymy się do omówienia tylko pierwszej z nich (metodę zaproponował John Selfridge).

Rozważmy ciąg [math]\displaystyle{ a_k = (- 1)^k (2 k + 1) }[/math], gdzie [math]\displaystyle{ k \geqslant 2 }[/math], czyli [math]\displaystyle{ a_k = (5, - 7, 9, - 11, 13, - 15, \ldots) }[/math]. Niech [math]\displaystyle{ D }[/math] będzie pierwszym wyrazem ciągu [math]\displaystyle{ (a_k) }[/math], dla którego jest [math]\displaystyle{ (a_k \mid m) = - 1 }[/math]. Dla tak ustalonego [math]\displaystyle{ D }[/math] przyjmujemy [math]\displaystyle{ P = 1 }[/math] i [math]\displaystyle{ Q = (1 - D) / 4 }[/math].

Tabela przedstawia początkowe wartości [math]\displaystyle{ Q }[/math], jakie otrzymamy, stosując tę metodę.


Zauważmy, że

  • jeżeli liczba nieparzysta [math]\displaystyle{ m }[/math] jest liczbą kwadratową, to wybór [math]\displaystyle{ D }[/math] nie będzie możliwy
  • w przypadku zastosowania tej metody znajdziemy tylko liczby pierwsze lub pseudopierwsze Lucasa, które spełniają kongruencję [math]\displaystyle{ U_{m + 1} \equiv 0 \pmod{m} }[/math], czyli tylko część liczb pseudopierwszych Lucasa określonych w definicji M22


Ponieważ Baillie i Wagstaff określili metodę zaproponowaną przez Selfridge'a jako metodę A, to pozostaniemy przy tej nazwie. Korzystając ze wzoru rekurencyjnego

[math]\displaystyle{ a_{k+1} = \begin{cases} \qquad \qquad 5 & \text{gdy } k = 1\\ - a_k - 2 * \mathop{\textnormal{sign}}( a_k ) & \text{gdy } k \geqslant 2 \end{cases} }[/math]

możemy łatwo napisać odpowiednią funkcję znajdującą liczby [math]\displaystyle{ P, Q }[/math] według tej metody.

MethodA(m) = 
{
local(a, js);
a = 5;
while( 1,
       js = jacobi(a, m);
       if( js == 0  &&  a % m <> 0, return([0, 0]) );
       if( js == -1, return([1, (1 - a)/4]) );
       a = -a - 2*sign(a);
     );
}

Wyjaśnienia wymaga druga linia kodu w pętli while. Wiemy, że (zobacz J38)

[math]\displaystyle{ (a \mid m) = 0 \quad \qquad \Longleftrightarrow \quad \qquad \gcd (a, m) \gt 1 }[/math]

Jednak z faktu, że [math]\displaystyle{ \gcd (a, m) \gt 1 }[/math] nie wynika natychmiast, że liczba [math]\displaystyle{ m }[/math] jest liczbą złożoną. Rozważmy dwa przypadki: gdy [math]\displaystyle{ m \mid a }[/math] i [math]\displaystyle{ m \nmid a }[/math].

Gdy [math]\displaystyle{ \gcd (a, m) \gt 1 }[/math] i [math]\displaystyle{ m \mid a }[/math], to [math]\displaystyle{ \gcd (a, m) = \gcd (k \cdot m, m) = m \gt 1 }[/math] i nie jesteśmy w stanie rozstrzygnąć, czy liczba [math]\displaystyle{ m }[/math] jest liczbą pierwszą, czy złożoną. Widać to dobrze na prostych przykładach

[math]\displaystyle{ \gcd (7, 7) = \gcd (14, 7) = 7 \gt 1 }[/math]
[math]\displaystyle{ \gcd (15, 15) = \gcd (30, 15) = 15 \gt 1 }[/math]

Gdy [math]\displaystyle{ \gcd (a, m) \gt 1 }[/math] i [math]\displaystyle{ m \nmid a }[/math], to [math]\displaystyle{ m }[/math] jest liczbą złożoną. Ponieważ [math]\displaystyle{ m \nmid a }[/math], to [math]\displaystyle{ a = k \cdot m + r }[/math], gdzie [math]\displaystyle{ r \in [1, m - 1] }[/math]. Mamy

[math]\displaystyle{ \gcd (a, m) = \gcd (k \cdot m + r, m) = \gcd (r, m) = d }[/math]

Musi być [math]\displaystyle{ d \gt 1 }[/math], bo założyliśmy, że [math]\displaystyle{ \gcd (a, m) \gt 1 }[/math] i musi być [math]\displaystyle{ d \lt m }[/math], bo [math]\displaystyle{ d \leqslant r \leqslant m - 1 }[/math]. Zatem [math]\displaystyle{ d }[/math] jest dzielnikiem nietrywialnym liczby [math]\displaystyle{ m }[/math] i [math]\displaystyle{ m }[/math] jest liczbą złożoną.

Omawiana linia kodu zapewnia wysłanie informacji o tym, że liczba [math]\displaystyle{ m }[/math] jest liczbą złożoną (zwrot wektora [0, 0]). W przypadku, gdy nie mamy takiej pewności, kontynuujemy szukanie liczby [math]\displaystyle{ a }[/math], takiej że [math]\displaystyle{ (a \mid m) = - 1 }[/math], pozostawiając zbadanie pierwszości liczby [math]\displaystyle{ m }[/math] na kolejnym etapie testowania.


Uważny Czytelnik dostrzeże, że nie zbadaliśmy, czy spełniony jest warunek [math]\displaystyle{ \gcd (m, Q) = 1 }[/math]. Nie musimy tego robić, bo zwracana przez funkcję MethodA() liczba [math]\displaystyle{ Q }[/math] jest względnie pierwsza z [math]\displaystyle{ m }[/math]. Omówimy ten problem dokładnie w zadaniu M30. Poniżej pokażemy, że nawet gdyby było [math]\displaystyle{ \gcd (m, Q) \gt 1 }[/math], to złożona liczba [math]\displaystyle{ m }[/math] nie zostanie uznana za liczbę pseudopierwszą Lucasa.

Zauważmy, że jeżeli [math]\displaystyle{ m }[/math] jest liczbą złożoną i ma dzielnik pierwszy [math]\displaystyle{ p \lt m }[/math], który dzieli [math]\displaystyle{ Q }[/math], to [math]\displaystyle{ p \mid Q }[/math] i [math]\displaystyle{ p \nmid P }[/math] (bo [math]\displaystyle{ P = 1 }[/math]), zatem [math]\displaystyle{ p \nmid U_k }[/math] dla [math]\displaystyle{ k \geqslant 1 }[/math] (zobacz M17), czyli nie może być

[math]\displaystyle{ U_{m + 1} (1, Q) \equiv 0 \pmod{m} }[/math]

bo mielibyśmy

[math]\displaystyle{ U_{m + 1} (1, Q) \equiv 0 \pmod{p} }[/math]

a to jest niemożliwe. Zatem program wykorzystujący twierdzenie M20 wykryje złożoność liczby [math]\displaystyle{ m }[/math].

Łatwo pokażemy, że nie jest możliwe, aby liczba [math]\displaystyle{ m }[/math] była liczbą pierwszą i była dzielnikiem [math]\displaystyle{ Q }[/math]. Jeżeli [math]\displaystyle{ m }[/math] jest liczbą pierwszą, to istnieje dokładnie [math]\displaystyle{ \tfrac{m - 1}{2} }[/math] liczb kwadratowych modulo [math]\displaystyle{ p }[/math] i [math]\displaystyle{ \tfrac{m - 1}{2} }[/math] liczb niekwadratowych modulo [math]\displaystyle{ p }[/math], zatem rozpoczynając od wyrazu [math]\displaystyle{ a_2 }[/math] możemy dojść co najwyżej do wyrazu o indeksie [math]\displaystyle{ k = \tfrac{m - 1}{2} + 2 }[/math], czyli

[math]\displaystyle{ | a_k | \leqslant m + 4 }[/math]

Skąd wynika, że

[math]\displaystyle{ | Q | = \left| {\small\frac{1 - a_k}{4}} \right| \leqslant {\small\frac{m + 5}{4}} \lt m }[/math]

Ostatnia nierówność jest prawdziwa dla [math]\displaystyle{ m \gt {\small\frac{5}{3}} }[/math], czyli dla wszystkich liczb pierwszych. Ponieważ [math]\displaystyle{ | Q | \lt m }[/math], w przypadku gdy [math]\displaystyle{ m }[/math] jest liczbą pierwszą, to [math]\displaystyle{ m }[/math] nie może być dzielnikiem liczby [math]\displaystyle{ Q }[/math].


Zadanie M30
Pokazać, że w przypadku, gdy dla kolejnych liczb [math]\displaystyle{ a_k = (- 1)^k (2 k + 1) }[/math] sprawdzamy, czy konsekwencją [math]\displaystyle{ (a_k \mid m) = 0 }[/math] jest złożoność liczby [math]\displaystyle{ m }[/math], to dla każdej liczby [math]\displaystyle{ Q }[/math] wyznaczonej metodą Selfridge'a jest [math]\displaystyle{ \gcd (Q, m) = 1 }[/math].

Rozwiązanie

Niech [math]\displaystyle{ m = 21 }[/math]. Rozpoczniemy od przykładu liczb [math]\displaystyle{ a_k = (- 1)^k (2 k + 1) }[/math] dla [math]\displaystyle{ k = 0, 1, \ldots, m - 1 }[/math].

Zauważmy, że modulo [math]\displaystyle{ 21 }[/math] ciąg [math]\displaystyle{ (a_k) = (1, - 3, 5, - 7, \ldots, 37, - 39, 41) }[/math] jest identyczny z ciągiem [math]\displaystyle{ (0, 1, 2, \ldots, 19, 20) }[/math], a ciąg [math]\displaystyle{ (| a_k |) }[/math] to kolejne liczby nieparzyste od [math]\displaystyle{ 1 }[/math] do [math]\displaystyle{ 2 m - 1 }[/math].


Poniżej pokażemy, dlaczego musi być [math]\displaystyle{ \gcd (Q, m) = 1 }[/math], gdzie [math]\displaystyle{ Q }[/math] jest liczbą wyznaczoną metodą Selfridge'a (o ile sprawdzana jest złożoność liczby [math]\displaystyle{ m }[/math] przy testowaniu kolejnych liczb [math]\displaystyle{ a_k }[/math]). Pogrubioną czcionką zaznaczone są symbole Jacobiego, które wykryły złożoność liczby [math]\displaystyle{ m }[/math]. Gdyby nie była badana złożoność, to wyliczona zostałaby wartość [math]\displaystyle{ Q }[/math] na podstawie innego wyrazu ciągu [math]\displaystyle{ a_k }[/math] (ten symbol Jacobiego został zapisany zwykłą czcionką).

[math]\displaystyle{ m = 3 , \;\; (5 \mid 3) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 5 , \;\; (5 \mid 5) = 0 , \;\; (- 7 \mid 5) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 \;\; }[/math] (zauważmy, że [math]\displaystyle{ (5 \mid 5) = 0 }[/math] nie pozwala wnioskować o złożoności)
[math]\displaystyle{ m = 7 , \;\; (5 \mid 7) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 9 , \;\; }[/math] (liczba kwadratowa)
[math]\displaystyle{ m = 11 , \;\; (- 11 \mid 11) = 0 , \;\; (13 \mid 11) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 \;\; }[/math] (zauważmy, że [math]\displaystyle{ (- 11 \mid 11) = 0 }[/math] nie pozwala wnioskować o złożoności)
[math]\displaystyle{ m = 13 , \;\; (5 \mid 13) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 15 , \;\; \boldsymbol{(5 \mid 15) = 0} , \;\; (13 \mid 15) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 3 \;\; }[/math] (gdyby nie zbadano złożoności)
[math]\displaystyle{ m = 17 , \;\; (5 \mid 17) = - 1 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 19 , \;\; (- 7 \mid 19) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 21 , \;\; \boldsymbol{(- 7 \mid 21) = 0} , \;\; (- 11 \mid 21) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 3 \;\; }[/math] (gdyby nie zbadano złożoności)


Niech [math]\displaystyle{ m \geqslant 23 }[/math]. Wiemy, że w ciągu [math]\displaystyle{ (5, - 7, 9, \ldots, \pm m, \mp (m + 2), \ldots, - (2 m - 3), 2 m - 1) }[/math] wystąpią liczby [math]\displaystyle{ a_k }[/math] takie, że [math]\displaystyle{ (a_k \mid m) = - 1 }[/math]. Warunek [math]\displaystyle{ (a_k \mid m) = 0 }[/math] oznacza, że [math]\displaystyle{ (2 k + 1 \mid m) = 0 }[/math], bo

[math]\displaystyle{ (a_k \mid m) = ((- 1)^k (2 k + 1) \mid m) = ((- 1)^k \mid m) \cdot (2 k + 1 \mid m) = (- 1 \mid m)^k \cdot (2 k + 1 \mid m) = \pm (2 k + 1 \mid m) }[/math]

Jeżeli będą spełnione warunki [math]\displaystyle{ (a_k \mid m) = 0 }[/math] i [math]\displaystyle{ R_m (a_k) \neq 0 }[/math], to liczba [math]\displaystyle{ m }[/math] będzie liczbą złożoną.

Wypiszmy kolejne próby dla [math]\displaystyle{ m \geqslant 23 }[/math]. Liczba [math]\displaystyle{ r }[/math] jest numerem próby.

[math]\displaystyle{ r = 1 , \;\; a_{r + 1} = 5 }[/math]
●    [math]\displaystyle{ (5 \mid m) = 1 }[/math] [math]\displaystyle{ 5 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (5 \mid m) = 0 }[/math] [math]\displaystyle{ 5 \mid m }[/math] koniec
●    [math]\displaystyle{ (5 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 5 \nmid m }[/math] [math]\displaystyle{ D = 5 , \;\; Q = - 1 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec
[math]\displaystyle{ r = 2 , \;\; a_{r + 1} = - 7 }[/math]
●    [math]\displaystyle{ (- 7 \mid m) = 1 }[/math] [math]\displaystyle{ 7 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (- 7 \mid m) = 0 }[/math] [math]\displaystyle{ 7 \mid m }[/math] koniec
●    [math]\displaystyle{ (- 7 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 7 \nmid m }[/math] [math]\displaystyle{ D = -7 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec
[math]\displaystyle{ r = 3 }[/math], [math]\displaystyle{ a_{r + 1} = 9 }[/math]
●    [math]\displaystyle{ (9 \mid m) = 1 }[/math] [math]\displaystyle{ 3 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (9 \mid m) = 0 }[/math] [math]\displaystyle{ 3 \mid m }[/math] koniec
●    [math]\displaystyle{ (9 \mid m) \neq - 1 \quad }[/math] - - - - bo [math]\displaystyle{ 9 }[/math] jest liczbą kwadratową


Po wykonaniu trzech prób niezakończonych sukcesem (tzn. wykryciem złożoności [math]\displaystyle{ m }[/math] lub ustaleniem wartości liczb [math]\displaystyle{ D }[/math] i [math]\displaystyle{ Q }[/math]) wiemy, że [math]\displaystyle{ m }[/math] nie jest podzielna przez żadną z liczb pierwszych [math]\displaystyle{ p = 3, 5, 7 }[/math].

[math]\displaystyle{ r }[/math]-ta próba, gdzie [math]\displaystyle{ r \geqslant 4 , \;\; }[/math] wyraz [math]\displaystyle{ a_{r + 1} }[/math]
●    [math]\displaystyle{ (a_{r + 1} \mid m) = 1 }[/math] żadna liczba pierwsza [math]\displaystyle{ p \leqslant | a_{r + 1} | = 2 r + 3 }[/math] nie dzieli liczby [math]\displaystyle{ m \quad }[/math]     przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (a_{r + 1} \mid m) = 0 }[/math] A. jeżeli [math]\displaystyle{ m \mid a_{r + 1} }[/math]( * )
B. jeżeli [math]\displaystyle{ m \nmid a_{r + 1} }[/math]
A. przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
B. [math]\displaystyle{ a_{r + 1} \mid m }[/math]( ** ), koniec
●    [math]\displaystyle{ (a_{r + 1} \mid m) = - 1 \quad }[/math] żadna liczba pierwsza [math]\displaystyle{ p \leqslant | a_{r + 1} | = 2 r + 3 }[/math] nie dzieli liczby [math]\displaystyle{ m \quad }[/math]     [math]\displaystyle{ D = a_{r + 1} }[/math], [math]\displaystyle{ Q = {\small\frac{1 - a_{r + 1}}{4}} }[/math], koniec

( * ) jest to możliwe tylko dla [math]\displaystyle{ a_{r + 1} = a_{(m - 1) / 2} = m }[/math]

( ** ) zauważmy, że jeżeli [math]\displaystyle{ m \nmid a_{r + 1} }[/math], to [math]\displaystyle{ \gcd (a_{r + 1}, m) = | a_{r + 1} | }[/math], bo gdyby liczba [math]\displaystyle{ | a_{r + 1} | }[/math] była liczbą złożoną, to żaden z jej dzielników pierwszych nie dzieliłby liczby [math]\displaystyle{ m }[/math]


Jeżeli nie została wykryta złożoność liczby [math]\displaystyle{ m }[/math], to żadna z liczb pierwszych [math]\displaystyle{ p \leqslant | a_{r + 1} | = 2 r + 3 }[/math] nie dzieli liczby [math]\displaystyle{ m }[/math]. Zatem [math]\displaystyle{ \gcd (Q, m) \gt 1 }[/math] może być tylko w przypadku, gdy pewna liczba pierwsza [math]\displaystyle{ q \geqslant 2 r + 5 }[/math] będzie wspólnym dzielnikiem liczb [math]\displaystyle{ Q }[/math] i [math]\displaystyle{ m }[/math], ale jest to niemożliwe, bo

[math]\displaystyle{ | Q | = \left| {\small\frac{1 - a_{r + 1}}{4}} \right| \leqslant {\small\frac{| a_{r + 1} | + 1}{4}} = {\small\frac{2 r + 4}{4}} \lt 2 r + 5 \leqslant q }[/math]

Przedostatnia (ostra) nierówność jest prawdziwa dla wszystkich [math]\displaystyle{ r }[/math] naturalnych.


Zadanie M31
Zmodyfikujmy metodę Selfridge'a w taki sposób, że będziemy rozpoczynali próby nie od wyrazu [math]\displaystyle{ a_2 = 5 }[/math], ale od wyrazu [math]\displaystyle{ a_3 = - 7 }[/math]. Pokazać, że w przypadku, gdy dla kolejnych liczb [math]\displaystyle{ a_k = (- 1)^k (2 k + 1) }[/math] sprawdzamy, czy konsekwencją [math]\displaystyle{ (a_k \mid m) = 0 }[/math] jest złożoność liczby [math]\displaystyle{ m }[/math], to dla każdej liczby [math]\displaystyle{ Q }[/math] wyznaczonej tak zmodyfikowaną metodą Selfridge'a jest [math]\displaystyle{ \gcd (Q, m) = 1 }[/math].

Rozwiązanie

Poniżej pokażemy, dlaczego musi być [math]\displaystyle{ \gcd (Q, m) = 1 }[/math], gdzie [math]\displaystyle{ Q }[/math] jest liczbą wyznaczoną zmodyfikowaną metodą Selfridge'a (o ile sprawdzana jest złożoność liczby [math]\displaystyle{ m }[/math] przy testowaniu kolejnych liczb [math]\displaystyle{ a_k }[/math]). Pogrubioną czcionką zaznaczone są symbole Jacobiego, które wykryły złożoność liczby [math]\displaystyle{ m }[/math]. Gdyby nie była badana złożoność, to wyliczona zostałaby wartość [math]\displaystyle{ Q }[/math] na podstawie innego wyrazu ciągu [math]\displaystyle{ a_k }[/math] (ten symbol Jacobiego został zapisany zwykłą czcionką).

[math]\displaystyle{ m = 3 , \;\; (- 7 \mid 3) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 5 , \;\; (- 7 \mid 5) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 7 , \;\; (- 7 \mid 7) = 0 , \;\; (- 11 \mid 7) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 1 }[/math] (zauważmy, że [math]\displaystyle{ (- 7 \mid 7) = 0 }[/math] nie pozwala wnioskować o złożoności)
[math]\displaystyle{ m = 9 , \;\; }[/math] (liczba kwadratowa)
[math]\displaystyle{ m = 11 , \;\; (- 11 \mid 11) = 0 , \;\; (13 \mid 11) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 \;\; }[/math] (zauważmy, że [math]\displaystyle{ (- 11 \mid 11) = 0 }[/math] nie pozwala wnioskować o złożoności)
[math]\displaystyle{ m = 13 , \;\; (- 7 \mid 13) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 15 , \;\; \boldsymbol{(9 \mid 15) = 0} , \;\; (13 \mid 15) = - 1 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 3 \;\; }[/math] (gdyby nie zbadano złożoności)
[math]\displaystyle{ m = 17 , \;\; (- 7 \mid 17) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 19 , \;\; (- 7 \mid 19) = - 1 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 }[/math]
[math]\displaystyle{ m = 21 , \;\; \boldsymbol{(- 7 \mid 21) = 0} , \;\; (- 11 \mid 21) = - 1 , \;\; Q = 3 , \;\; \gcd (m, Q) = 3 \;\; }[/math] (gdyby nie zbadano złożoności)


Niech [math]\displaystyle{ m \geqslant 23 }[/math]. Wiemy, że w ciągu [math]\displaystyle{ ( - 7, 9, \ldots, \pm m, \mp (m + 2), \ldots, - (2 m - 3), 2 m - 1) }[/math] wystąpią liczby [math]\displaystyle{ a_k }[/math] takie, że [math]\displaystyle{ (a_k \mid m) = - 1 }[/math]. Warunek [math]\displaystyle{ (a_k \mid m) = 0 }[/math] oznacza, że [math]\displaystyle{ (2 k + 1 \mid m) = 0 }[/math], bo

[math]\displaystyle{ (a_k \mid m) = ((- 1)^k (2 k + 1) \mid m) = ((- 1)^k \mid m) \cdot (2 k + 1 \mid m) = (- 1 \mid m)^k \cdot (2 k + 1 \mid m) = \pm (2 k + 1 \mid m) }[/math]

Jeżeli będą spełnione warunki [math]\displaystyle{ (a_k \mid m) = 0 }[/math] i [math]\displaystyle{ R_m (a_k) \neq 0 }[/math], to liczba [math]\displaystyle{ m }[/math] będzie liczbą złożoną.

Wypiszmy kolejne próby dla [math]\displaystyle{ m \geqslant 23 }[/math]. Liczba [math]\displaystyle{ r }[/math] jest numerem próby.

[math]\displaystyle{ r = 1 , \;\; a_{r + 2} = - 7 }[/math]
●    [math]\displaystyle{ (- 7 \mid m) = 1 }[/math] [math]\displaystyle{ 7 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (- 7 \mid m) = 0 }[/math] [math]\displaystyle{ 7 \mid m }[/math] koniec
●    [math]\displaystyle{ (- 7 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 7 \nmid m }[/math] [math]\displaystyle{ D = - 7 , \;\; Q = 2 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec
[math]\displaystyle{ r = 2 , \;\; a_{r + 2} = 9 }[/math]
●    [math]\displaystyle{ (9 \mid m) = 1 }[/math] [math]\displaystyle{ 3 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (9 \mid m) = 0 }[/math] [math]\displaystyle{ 3 \mid m }[/math] koniec
●    [math]\displaystyle{ (9 \mid m) \neq - 1 \quad }[/math] - - - - bo [math]\displaystyle{ 9 }[/math] jest liczbą kwadratową
[math]\displaystyle{ r = 3 , \;\; a_{r + 2} = - 11 }[/math]
●    [math]\displaystyle{ (- 11 \mid m) = 1 }[/math] [math]\displaystyle{ 11 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (- 11 \mid m) = 0 }[/math] [math]\displaystyle{ 11 \mid m }[/math] koniec
●    [math]\displaystyle{ (- 11 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 11 \nmid m }[/math] [math]\displaystyle{ D = - 11 , \;\; Q = 3 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec (bo liczby złożone [math]\displaystyle{ m = 3 k }[/math] zostały usunięte w poprzedniej próbie, [math]\displaystyle{ r = 2 }[/math])
[math]\displaystyle{ r = 4 , \;\; a_{r + 2} = 13 }[/math]
●    [math]\displaystyle{ (13 \mid m) = 1 }[/math] [math]\displaystyle{ 13 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (13 \mid m) = 0 }[/math] [math]\displaystyle{ 13 \mid m }[/math] koniec
●    [math]\displaystyle{ (13 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 13 \nmid m }[/math] [math]\displaystyle{ D = 13 , \;\; Q = - 3 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec (bo liczby złożone [math]\displaystyle{ m = 3 k }[/math] zostały usunięte w próbie o numerze [math]\displaystyle{ r = 2 }[/math])
[math]\displaystyle{ r = 5 , \;\; a_{r + 2} = - 15 }[/math]
●    [math]\displaystyle{ (- 15 \mid m) = 1 }[/math] [math]\displaystyle{ 5 \nmid m \quad }[/math] przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (- 15 \mid m) = 0 }[/math] [math]\displaystyle{ 5 \mid m }[/math] koniec
●    [math]\displaystyle{ (- 15 \mid m) = - 1 \quad }[/math] [math]\displaystyle{ 5 \nmid m }[/math] [math]\displaystyle{ D = - 15 , \;\; Q = 4 , \;\; \gcd (m, Q) = 1 , \;\; }[/math] koniec


Po wykonaniu pięciu prób niezakończonych sukcesem (tzn. wykryciem złożoności [math]\displaystyle{ m }[/math] lub ustaleniem wartości liczb [math]\displaystyle{ D }[/math] i [math]\displaystyle{ Q }[/math]) wiemy, że [math]\displaystyle{ m }[/math] nie jest podzielna przez żadną z liczb pierwszych [math]\displaystyle{ p = 3, 5, 7, 11, 13 }[/math].

[math]\displaystyle{ r }[/math]-ta próba, gdzie [math]\displaystyle{ r \geqslant 6 , \;\; }[/math] wyraz [math]\displaystyle{ a_{r + 2} }[/math]
●    [math]\displaystyle{ (a_{r + 2} \mid m) = 1 }[/math] żadna liczba pierwsza [math]\displaystyle{ p \leqslant | a_{r + 2} | = 2 r + 5 }[/math] nie dzieli liczby [math]\displaystyle{ m \quad }[/math]     przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
●    [math]\displaystyle{ (a_{r + 2} \mid m) = 0 }[/math] A. jeżeli [math]\displaystyle{ m \mid a_{r + 2} }[/math]( * )
B. jeżeli [math]\displaystyle{ m \nmid a_{r + 2} }[/math]
A. przechodzimy do kolejnego wyrazu ciągu [math]\displaystyle{ (a_k) }[/math]
B. [math]\displaystyle{ a_{r + 1} \mid m }[/math]( ** ), koniec
●    [math]\displaystyle{ (a_{r + 2} \mid m) = - 1 \quad }[/math] żadna liczba pierwsza [math]\displaystyle{ p \leqslant | a_{r + 2} | = 2 r + 5 }[/math] nie dzieli liczby [math]\displaystyle{ m \quad }[/math]     [math]\displaystyle{ D = a_{r + 2} }[/math], [math]\displaystyle{ Q = {\small\frac{1 - a_{r + 2}}{4}} }[/math], koniec

( * ) jest to możliwe tylko dla [math]\displaystyle{ a_{r + 2} = a_{(m - 1) / 2} = m }[/math]

( ** ) zauważmy, że jeżeli [math]\displaystyle{ m \nmid a_{r + 2} }[/math], to [math]\displaystyle{ \gcd (a_{r + 2}, m) = | a_{r + 2} | }[/math], bo gdyby liczba [math]\displaystyle{ | a_{r + 2} | }[/math] była liczbą złożoną, to żaden z jej dzielników pierwszych nie dzieliłby liczby [math]\displaystyle{ m }[/math]


Jeżeli nie została wykryta złożoność liczby [math]\displaystyle{ m }[/math], to żadna z liczb pierwszych [math]\displaystyle{ p \leqslant | a_{r + 2} | = 2 r + 5 }[/math] nie dzieli liczby [math]\displaystyle{ m }[/math]. Zatem [math]\displaystyle{ \gcd (Q, m) \gt 1 }[/math] może być tylko w przypadku, gdy pewna liczba pierwsza [math]\displaystyle{ q \geqslant 2 r + 7 }[/math] będzie wspólnym dzielnikiem liczb [math]\displaystyle{ Q }[/math] i [math]\displaystyle{ m }[/math], ale jest to niemożliwe, bo

[math]\displaystyle{ | Q | = \left| {\small\frac{1 - a_{r + 2}}{4}} \right| \leqslant {\small\frac{| a_{r + 2} | + 1}{4}} = {\small\frac{2 r + 6}{4}} \lt 2 r + 7 \leqslant q }[/math]

Przedostatnia (ostra) nierówność jest prawdziwa dla wszystkich [math]\displaystyle{ r }[/math] naturalnych.


Uwaga M32
Przyjmując metodę Selfridge'a wyboru parametrów [math]\displaystyle{ P, Q }[/math] dla testu Lucasa, możemy łatwo napisać odpowiedni program w PARI/GP testujący pierwszość liczb

LucasTest(m) = 
{
local(P, Q, X);
if( m % 2 == 0, return(m == 2) );
if( issquare(m), return(0) ); \\ sprawdzamy, czy m nie jest liczbą kwadratową
X = MethodA(m);
P = X[1];
Q = X[2];
if( P == 0, return(0) ); \\ jeżeli P = 0, to m jest liczbą złożoną
if( modLucas(m + 1, P, Q, m)[1] == 0, return(1), return(0) );
}


Uwaga M33
Najmniejsze liczby pseudopierwsze Lucasa, które pojawiają się przy zastosowaniu metody Selfridge'a wyboru parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math], to

[math]\displaystyle{ 323, 377, 1159, 1829, 3827, 5459, 5777, 9071, 9179, 10877, 11419, 11663, 13919, 14839, 16109, 16211, 18407, 18971, 19043, 22499, \ldots }[/math]
Pokaż kod
forstep(k=1, 3*10^4, 2, if( LucasTest(k) && !isprime(k), print(k)) )



Tabela przedstawia ilość takich liczb nie większych od [math]\displaystyle{ 10^n }[/math]

Pokaż kod
for(n=3, 9, s=0; forstep(k = 1, 10^n, 2, if( LucasTest(k) && !isprime(k), s++ ) ); print("n= ", n, "   ", s) )




Liczby silnie pseudopierwsze Lucasa

Twierdzenie M34
Jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą taką, że [math]\displaystyle{ \gcd (p, Q D) = 1 }[/math] oraz [math]\displaystyle{ p - (D \mid p) = 2^r w }[/math], gdzie [math]\displaystyle{ w }[/math] jest liczbą nieparzystą, to spełniony jest dokładnie jeden z warunków

[math]\displaystyle{ U_w \equiv 0 \pmod{p} }[/math]

lub

[math]\displaystyle{ V_{2^k w} \equiv 0 \pmod{p} \qquad }[/math] dla pewnego [math]\displaystyle{ k \in [0, r - 1] }[/math]
Dowód

Wiemy (zobacz M20), że jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą taką, że [math]\displaystyle{ \gcd (p, Q D) = 1 }[/math], to [math]\displaystyle{ p \mid U_{p - (D \mid p)} }[/math]. Z założenia jest [math]\displaystyle{ p - (D \mid p) = 2^r w }[/math], zatem [math]\displaystyle{ p \mid U_{2^r w} }[/math]. Ponieważ założyliśmy, że [math]\displaystyle{ p \nmid Q }[/math] i [math]\displaystyle{ p \nmid D }[/math], to ze wzoru [math]\displaystyle{ V^2_n - D U^2_n = 4 Q^n }[/math] (zobacz M13 p.14) wynika natychmiast, że [math]\displaystyle{ p }[/math] nie może dzielić jednocześnie liczb [math]\displaystyle{ U_n }[/math] i [math]\displaystyle{ V_n }[/math].

Korzystając ze wzoru [math]\displaystyle{ U_{2 n} = U_n V_n }[/math] (zobacz M13 p.11), otrzymujemy

●    [math]\displaystyle{ p \mid U_{2^r w} \;\; \Longleftrightarrow \;\; p \mid U_{2^{r - 1} w} \cdot V_{2^{r - 1} w} \quad }[/math] Jeżeli [math]\displaystyle{ p \mid V_{2^{r - 1} w} }[/math], to twierdzenie jest dowiedzione. Jeżeli [math]\displaystyle{ p \nmid V_{2^{r - 1} w} }[/math], to [math]\displaystyle{ p \mid U_{2^{r - 1} w} }[/math].
●    [math]\displaystyle{ p \mid U_{2^{r - 1} w} \;\; \Longleftrightarrow \;\; p \mid U_{2^{r - 2} w} \cdot V_{2^{r - 2} w} \quad }[/math] Jeżeli [math]\displaystyle{ p \mid V_{2^{r - 2} w} }[/math], to twierdzenie jest dowiedzione. Jeżeli [math]\displaystyle{ p \nmid V_{2^{r - 2} w} }[/math], to [math]\displaystyle{ p \mid U_{2^{r - 2} w} }[/math].
●    [math]\displaystyle{ ................. }[/math]
●    [math]\displaystyle{ p \mid U_{4 w} \;\; \Longleftrightarrow \;\; p \mid U_{2 w} \cdot V_{2 w} }[/math] Jeżeli [math]\displaystyle{ p \mid V_{2 w} }[/math], to twierdzenie jest dowiedzione. Jeżeli [math]\displaystyle{ p \nmid V_{2 w} }[/math], to [math]\displaystyle{ p \mid U_{2 w} }[/math].
●    [math]\displaystyle{ p \mid U_{2 w} \;\; \Longleftrightarrow \;\; p \mid U_w \cdot V_w }[/math] Jeżeli [math]\displaystyle{ p \mid V_w }[/math], to twierdzenie jest dowiedzione. Jeżeli [math]\displaystyle{ p \nmid V_w }[/math], to [math]\displaystyle{ p \mid U_w }[/math].

Z powyższego wynika, że musi być spełniony jeden z wypisanych w twierdzeniu warunków.


Zauważmy teraz, że jeżeli liczba pierwsza [math]\displaystyle{ p }[/math] dzieli [math]\displaystyle{ V_w }[/math], to [math]\displaystyle{ p \nmid U_w }[/math], bo [math]\displaystyle{ p }[/math] nie może jednocześnie być dzielnikiem liczb [math]\displaystyle{ U_w }[/math] i [math]\displaystyle{ V_w }[/math].

Zauważmy też, że jeżeli dla pewnego [math]\displaystyle{ k \in [1, r - 1] }[/math] liczba pierwsza [math]\displaystyle{ p }[/math] dzieli [math]\displaystyle{ V_{2^k w} }[/math], to [math]\displaystyle{ p }[/math] nie dzieli żadnej liczby [math]\displaystyle{ V_{2^j w} }[/math] dla [math]\displaystyle{ j \in [0, k - 1] \;\; \text{i} \;\; p \nmid U_w }[/math]. Istotnie:

●    jeżeli [math]\displaystyle{ p \mid V_{2^k w} }[/math], to [math]\displaystyle{ p \nmid U_{2^k w} \;\; \text{i} \;\; U_{2^k w} = U_{2^{k - 1} w} V_{2^{k - 1} w} }[/math], zatem [math]\displaystyle{ p }[/math] nie może być dzielnikiem żadnej z liczb [math]\displaystyle{ U_{2^{k - 1} w} \;\; \text{i} \;\; V_{2^{k - 1} w} }[/math]
●    jeżeli [math]\displaystyle{ p \nmid U_{2^{k - 1} w} \;\; \text{i} \;\; U_{2^{k - 1} w} = U_{2^{k - 2} w} V_{2^{k - 2} w} }[/math], to [math]\displaystyle{ p }[/math] nie może być dzielnikiem żadnej z liczb [math]\displaystyle{ U_{2^{k - 2} w} \;\; \text{i} \;\; V_{2^{k - 2} w} }[/math]
●    [math]\displaystyle{ ................. }[/math]
●    jeżeli [math]\displaystyle{ p \nmid U_{4 w} \;\; \text{i} \;\; U_{4 w} = U_{2 w} V_{2 w} }[/math], to [math]\displaystyle{ p }[/math] nie może być dzielnikiem żadnej z liczb [math]\displaystyle{ U_{2 w} \;\; \text{i} \;\; V_{2 w} }[/math]
●    jeżeli [math]\displaystyle{ p \nmid U_{2 w} \;\; \text{i} \;\; U_{2 w} = U_w V_w }[/math], to [math]\displaystyle{ p }[/math] nie może być dzielnikiem żadnej z liczb [math]\displaystyle{ U_w \;\; \text{i} \;\; V_w }[/math]


Co dowodzi, że spełniony jest dokładnie jeden z [math]\displaystyle{ r + 1 }[/math] warunków:

[math]\displaystyle{ U_w \equiv 0 \pmod{p} }[/math]
[math]\displaystyle{ V_{2^k w} \equiv 0 \pmod{p} \qquad }[/math] gdzie [math]\displaystyle{ k \in [0, r - 1] }[/math]

Co należało pokazać.


Konsekwentnie definiujemy liczby pseudopierwsze
Definicja M35
Powiemy, że liczba złożona nieparzysta [math]\displaystyle{ m }[/math] jest liczbą silnie pseudopierwszą Lucasa (SLPSP) dla parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math], jeżeli [math]\displaystyle{ \gcd (m, Q D) = 1 }[/math] oraz [math]\displaystyle{ m - (D \mid m) = 2^r w }[/math], gdzie [math]\displaystyle{ w }[/math] jest liczbą nieparzystą i spełniony jest jeden z warunków

[math]\displaystyle{ U_w \equiv 0 \pmod{m} }[/math]

lub

[math]\displaystyle{ V_{2^k w} \equiv 0 \pmod{m} \; }[/math] dla pewnego [math]\displaystyle{ k \in [0, r - 1] }[/math]


Uwaga M36
Każda liczba SLPSP([math]\displaystyle{ P, Q }[/math]) jest LPSP([math]\displaystyle{ P, Q }[/math]). Korzystając ze zdefiniowanych wcześniej funkcji: modPower(a, n, m), jacobi(a, n) i modLucas(n, P, Q, m) (zobacz L2, J44, M15), możemy napisać prosty program, który sprawdza, czy liczba [math]\displaystyle{ m }[/math] spełnia jeden z warunków podanych w twierdzeniu M34.

isPrimeOrSLPSP(m, P, Q) = 
{
local(a, b, c, D, js, k, r, w, X);
D = P^2 - 4*Q;
if( gcd(m, 2*Q*D) > 1, return(0) );
js = jacobi(D, m);
r = valuation(m - js, 2); \\ znajdujemy wykładnik, z jakim liczba 2 występuje w m - js
w = (m - js) / 2^r;
X =  modLucas(w, P, Q, m);
a = X[1]; \\ U_w(P, Q) % m
b = X[2]; \\ V_w(P, Q) % m
if( a == 0 || b == 0, return(1) ); \\ b == 0 to przypadek k == 0
if( r == 1, return(0) ); \\ nie ma dalszych przypadków
c = modPower(Q, w, m); \\ Q^w % m
k = 0;
\\ sprawdzamy warunek V_(2^k * w) % m = 0; korzystamy ze wzoru V_(2*t) = (V_t)^2 - 2*Q^t
while( k++ < r,
       b = (b^2 - 2*c) % m;
       if( b == 0, return(1) );
       c = c^2 % m;
     );
return(0);
}


Przykład M37
Poniższa tabela zawiera najmniejsze liczby silnie pseudopierwsze Lucasa dla różnych parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math]

Pokaż kod
FirstSLPSP(Stop) = 
\\ najmniejsze SLPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
{
local(D, m, P, Q);
Q = -6;
while( Q++ <= 5,
       if( Q == 0, next() );
       P = 0;
       while( P++ <= 10,
              D = P^2 - 4*Q;
              if( D == 0, 
                  print("Q= ", Q, "   P= ", P, "   ------------------");
                  next();
                );
              m = 3;
              while( m < Stop,
                     if( isPrimeOrSLPSP(m, P, Q)  &&  !isprime(m), 
                         print("Q= ", Q, "   P= ", P, "   m= ", m, "   (D|m)= ", jacobi(D, m));
                         break();
                       );
                     m = m + 2;
                   );
           );
     );
}


Żółtym tłem oznaczyliśmy te najmniejsze liczby pseudopierwsze Lucasa, dla których [math]\displaystyle{ (D \mid m) = - 1 }[/math].


Przykład M38
Ilość liczb SLPSP([math]\displaystyle{ P, Q }[/math]) mniejszych od [math]\displaystyle{ 10^9 }[/math]


Pokaż kod
NumOfSLPSP(Stop) = 
\\ ilość liczb silnie pseudopierwszych Lucasa SLPSP(P,Q) < Stop;  dla 1<=P<=10 i -5<=Q<=5
{
local(D, m, P, Q);
Q = -6;
while( Q++ <= 5,
       if( Q == 0, next() );
       P = 0;
       while( P++ <= 10,
              D = P^2 - 4*Q;
              if( D == 0, print("Q= ", Q, "   P= ", P, "   ------------------"); next() );
              s = 0;
              m = 3;
              while( m < Stop,
                     if( isPrimeOrSLPSP(m, P, Q)  &&  !isprime(m), s++ );
                     m = m + 2;
                   );
              print("Q= ", Q, "   P= ", P, "   s= ", s);
            );
     );
}



Uwaga M39
Można pokazać[2], że dla liczby złożonej nieparzystej [math]\displaystyle{ m \neq 9 }[/math] i ustalonego [math]\displaystyle{ D }[/math] ilość par [math]\displaystyle{ P, Q }[/math] takich, że

  • [math]\displaystyle{ 0 \leqslant P, Q \lt m }[/math]
  • [math]\displaystyle{ \gcd (Q, m) = 1 }[/math]
  • [math]\displaystyle{ P^2 - 4 Q \equiv D \pmod{m} }[/math]
  • [math]\displaystyle{ m }[/math] jest SLPSP([math]\displaystyle{ P, Q }[/math])

nie przekracza [math]\displaystyle{ \tfrac{4}{15} n }[/math].

Nie dotyczy to przypadku, gdy [math]\displaystyle{ m = p (p + 2) }[/math] jest iloczynem liczb pierwszych bliźniaczych takich, że [math]\displaystyle{ (D \mid p) = - (D \mid p + 2) = - 1 }[/math], wtedy mamy słabsze oszacowanie: [math]\displaystyle{ \# (P, Q) \leqslant \tfrac{1}{2} n }[/math]. Zauważmy, że taką sytuację łatwo wykryć, bo w tym przypadku [math]\displaystyle{ m + 1 = (p + 1)^2 }[/math] jest liczbą kwadratową.


Uwaga M40
Podobnie jak w przypadku liczb pseudopierwszych Lucasa LPSP([math]\displaystyle{ P, Q }[/math]) tak i w przypadku liczb silnie pseudopierwszych Lucasa SLPSP([math]\displaystyle{ P, Q }[/math]) możemy testować pierwszość liczby [math]\displaystyle{ m }[/math], wybierając liczby [math]\displaystyle{ P, Q }[/math] losowo lub zastosować wybraną metodę postępowania. Przedstawiony poniżej program, to zmodyfikowany kod z uwagi M36. Teraz parametry [math]\displaystyle{ P, Q }[/math] są wybierane metodą Selfridge'a, a symbol Jacobiego [math]\displaystyle{ (D \mid m) }[/math] jest równy [math]\displaystyle{ - 1 }[/math].

StrongLucasTest(m) =
{
local(a, b, c, k, P, Q, r, w, X);
if( m % 2 == 0, return(m == 2) );
if( issquare(m), return(0) ); \\ sprawdzamy, czy liczba m nie jest kwadratowa
X = MethodA(m);
P = X[1];
Q = X[2];
if( P == 0 || gcd(m, 2*Q) > 1, return(0) ); \\ jeżeli P = 0, to m jest liczbą złożoną
r = valuation(m + 1, 2); \\ znajdujemy wykładnik, z jakim liczba 2 występuje w m + 1
w = (m + 1) / 2^r;
X =  modLucas(w, P, Q, m);
a = X[1]; \\ U_w(P, Q) % m
b = X[2]; \\ V_w(P, Q) % m
if( a == 0 || b == 0, return(1) ); \\ b == 0 to przypadek k == 0
if( r == 1, return(0) ); \\ nie ma dalszych przypadków
c = modPower(Q, w, m); \\ Q^w % m
k = 0;
\\ sprawdzamy warunek V_(2^k * w) %m = 0; korzystamy ze wzoru V_(2*w) = (V_w)^2 - 2*Q^w
while( k++ < r,
       b = (b^2 - 2*c) % m;
       if( b == 0, return(1) );
       c = c^2 % m;
     );
return(0);
}


Uwaga M41
Najmniejsze liczby silnie pseudopierwsze Lucasa, które otrzymujemy po zastosowaniu metody Selfridge'a wyboru parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math], to

[math]\displaystyle{ 5459, 5777, 10877, 16109, 18971, 22499, 24569, 25199, 40309, 58519, 75077, 97439, \ldots }[/math]
Pokaż kod
forstep(k=1, 10^5, 2, if( StrongLucasTest(k) && !isprime(k), print(k)) )



Tabela przedstawia ilość takich liczb nie większych od [math]\displaystyle{ 10^n }[/math]

Pokaż kod
for(n=3, 9, s=0; forstep(k = 1, 10^n, 2, if( StrongLucasTest(k) && !isprime(k), s++ ) ); print("n=", n, "   ", s) )




Test BPSW

Uwaga M42
Jest [math]\displaystyle{ 488 }[/math] liczb SPSP([math]\displaystyle{ 2 }[/math]) mniejszych od [math]\displaystyle{ 10^8 }[/math] i są 582 liczby SPSP([math]\displaystyle{ 3 }[/math]) mniejsze od [math]\displaystyle{ 10^8 }[/math] (zobacz L21). Ale jest aż [math]\displaystyle{ 21 }[/math] liczb mniejszych od [math]\displaystyle{ 10^8 }[/math] silnie pseudopierwszych jednocześnie względem podstaw [math]\displaystyle{ 2 }[/math] i [math]\displaystyle{ 3 }[/math]:

[math]\displaystyle{ 1373653, 1530787, 1987021, 2284453, 3116107, 5173601, 6787327, 11541307, 13694761, 15978007, 16070429, }[/math]

[math]\displaystyle{ 16879501, 25326001, 27509653, 27664033, 28527049, 54029741, 61832377, 66096253, 74927161, 80375707 }[/math]

Pokaż kod
forstep(m=3, 10^8, 2, if( isPrimeOrSPSP(m, 2)  &&  isPrimeOrSPSP(m, 3)  &&  !isprime(m), print("m=", m) ) )


Widzimy, że prawdopodobieństwo błędnego rozpoznania pierwszości w przypadku liczb mniejszych od [math]\displaystyle{ 10^8 }[/math] dla podstawy [math]\displaystyle{ 2 }[/math] lub podstawy [math]\displaystyle{ 3 }[/math] jest rzędu kilku milionowych. Gdyby prawdopodobieństwa błędnego rozpoznania pierwszości w przypadku podstawy [math]\displaystyle{ 2 }[/math] lub podstawy [math]\displaystyle{ 3 }[/math] były niezależne, to spodziewalibyśmy się, że nie będzie wcale liczb mniejszych od [math]\displaystyle{ 10^8 }[/math] silnie pseudopierwszych jednocześnie względem podstaw [math]\displaystyle{ 2 }[/math] i [math]\displaystyle{ 3 }[/math], bo prawdopodobieństwo takiego zdarzenia byłoby równe kilkudziesięciu bilonowym. Ale tak nie jest.

Jest to mocny argument za tym, że zastosowanie różnych (niezależnych) testów może być znacznie silniejszym narzędziem do testowania pierwszości liczb, niż wielokrotne stosowanie tego samego testu, gdzie poszczególne próby są tylko pozornie niezależne.

Połączenie znanych nam już testów prowadzi do prostego programu

BPSWtest(m) =
{
forprime(p = 2, 1000, if( m % p > 0, next() ); if( m == p, return(1), return(0) ));
if( !isPrimeOrSPSP(m, 2), return(0) );
if( !StrongLucasTest(m), return(0), return(1) );
}


Funkcja BPSWtest(m) kolejno sprawdza:

  • czy liczba [math]\displaystyle{ m }[/math] jest podzielna przez niewielkie liczby pierwsze (w naszym przypadku mniejsze od [math]\displaystyle{ 1000 }[/math]); jeśli tak, to sprawdza, czy [math]\displaystyle{ m }[/math] jest liczbą pierwszą, czy złożoną i zwraca odpowiednio [math]\displaystyle{ 1 }[/math] lub [math]\displaystyle{ 0 }[/math]
  • czy liczba [math]\displaystyle{ m }[/math] przechodzi test Millera-Rabina dla podstawy [math]\displaystyle{ 2 }[/math]; jeśli nie, to zwraca [math]\displaystyle{ 0 }[/math]
  • czy liczba [math]\displaystyle{ m }[/math] przechodzi silny test Lucasa dla parametrów [math]\displaystyle{ P }[/math] i [math]\displaystyle{ Q }[/math], które wybieramy metodą Selfridge'a; jeśli nie, to zwraca [math]\displaystyle{ 0 }[/math], w przeciwnym wypadku zwraca [math]\displaystyle{ 1 }[/math]


Test w dokładnie takiej postaci zaproponowali Robert Baillie i Samuel Wagstaff[1]. Nazwa testu to akronim, utworzony od pierwszych liter nazwisk Roberta Bailliego, Carla Pomerance'a, Johna Selfridge'a i Samuela Wagstaffa.

Nie jest znany żaden przykład liczby złożonej [math]\displaystyle{ m }[/math], którą test BPSW[3][4] identyfikowałby jako pierwszą i z pewnością nie ma takich liczb dla [math]\displaystyle{ m \lt 2^{64} \approx 1.844 \cdot 10^{19} }[/math]. Warto przypomnieć: potrzebowaliśmy siedmiu testów Millera-Rabina (dla podstaw [math]\displaystyle{ 2, 3, 5, 7, 11, 13, 17 }[/math]), aby mieć pewność, że dowolna liczba [math]\displaystyle{ m \lt 3.41 \cdot 10^{14} }[/math] jest pierwsza (zobacz L22).



Uzupełnienia

 

Pewne własności współczynników dwumianowych

 

Twierdzenie M43
Jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą, to

[math]\displaystyle{ \binom{p}{k} \equiv 0 \pmod{p} }[/math]

dla każdego [math]\displaystyle{ k \in [1, p - 1] }[/math].

Dowód

Łatwo zauważamy, że dla [math]\displaystyle{ k \in [1, p - 1] }[/math] liczba pierwsza [math]\displaystyle{ p }[/math] dzieli licznik, ale nie dzieli mianownika współczynnika dwumianowego

[math]\displaystyle{ \binom{p}{k} = {\small\frac{p!}{k! \cdot (p - k)!}} }[/math]

zatem [math]\displaystyle{ p \biggr\rvert \binom{p}{k} }[/math]. Co należało pokazać.


Twierdzenie M44
Jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą, to

[math]\displaystyle{ \binom{p + 1}{k} \equiv 0 \pmod{p} }[/math]

dla każdego [math]\displaystyle{ k \in [2, p - 1] }[/math].

Dowód

Jeżeli [math]\displaystyle{ k \in [2, p - 1] }[/math], to modulo [math]\displaystyle{ p }[/math] dostajemy

[math]\displaystyle{ \binom{p + 1}{k} = \binom{p}{k} + \binom{p}{k - 1} \equiv 0 \pmod{p} }[/math]

Bo liczba pierwsza [math]\displaystyle{ p }[/math] dzieli licznik, ale nie dzieli mianownika współczynników dwumianowych po prawej stronie. Co należało pokazać.


Twierdzenie M45
Jeżeli [math]\displaystyle{ p }[/math] jest liczbą pierwszą, to

[math]\displaystyle{ \binom{p - 1}{k} \equiv (- 1)^k \pmod{p} }[/math]

dla każdego [math]\displaystyle{ k \in [0, p - 1] }[/math].

Dowód

Łatwo sprawdzamy, że twierdzenie jest prawdziwe dla liczby pierwszej parzystej [math]\displaystyle{ p = 2 }[/math]. Załóżmy, że [math]\displaystyle{ p }[/math] jest liczbą pierwszą nieparzystą. Równie łatwo sprawdzamy, że twierdzenie jest prawdziwe dla [math]\displaystyle{ k = 0 }[/math] i [math]\displaystyle{ k = 1 }[/math]. Zauważmy, że dla [math]\displaystyle{ k \in [1, p - 1] }[/math] jest

[math]\displaystyle{ \binom{p - 1}{k} = {\small\frac{(p - 1) !}{k! (p - 1 - k) !}} = {\small\frac{p - k}{k}} \cdot {\small\frac{(p - 1) !}{(k - 1) ! (p - k) !}} = {\small\frac{p - k}{k}} \cdot \binom{p - 1}{k - 1} = {\small\frac{p}{k}} \cdot \binom{p - 1}{k - 1} - \binom{p - 1}{k - 1} }[/math]

Ponieważ współczynniki dwumianowe są liczbami całkowitymi, a liczba [math]\displaystyle{ k \in [2, p - 1] }[/math] nie dzieli liczby pierwszej nieparzystej [math]\displaystyle{ p }[/math], to [math]\displaystyle{ k }[/math] musi dzielić liczbę [math]\displaystyle{ \binom{p - 1}{k - 1} }[/math]. Zatem dla [math]\displaystyle{ k \in [2, p - 1] }[/math] modulo [math]\displaystyle{ p }[/math] mamy

[math]\displaystyle{ \binom{p - 1}{k} \equiv - \binom{p - 1}{k - 1}\pmod{p} }[/math]

Skąd otrzymujemy

[math]\displaystyle{ \binom{p - 1}{k} \equiv (- 1)^1 \binom{p - 1}{k - 1} \equiv (- 1)^2 \binom{p - 1}{k - 2} \equiv \ldots \equiv (- 1)^{k - 2} \binom{p - 1}{2} \equiv (- 1)^{k - 1} \binom{p - 1}{1} \equiv (- 1)^k \pmod{p} }[/math]

Co należało pokazać.


Twierdzenie M46
Dla współczynników dwumianowych prawdziwe są następujące wzory

[math]\displaystyle{ \underset{k \; \text{parzyste}}{\sum_{k = 0}^{n}} \binom{n}{k} = 2^{n - 1} }[/math]
[math]\displaystyle{ \underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^{n - 1} }[/math]
Dowód

Ze wzoru dwumianowego

[math]\displaystyle{ (a + b)^n = \sum_{k = 0}^{n} \binom{n}{k} a^{n - k} b^k }[/math]

z łatwością otrzymujemy

[math]\displaystyle{ (1 + 1)^n = \sum_{k = 0}^{n} \binom{n}{k} = 2^n }[/math]
[math]\displaystyle{ (1 - 1)^n = \sum_{k = 0}^{n} (- 1)^k \binom{n}{k} = 0 }[/math]

Obliczając sumę i różnicę powyższych wzorów mamy

[math]\displaystyle{ \sum_{k = 0}^{n} \binom{n}{k} (1 + (- 1)^k) = 2 \underset{k \; \text{parzyste}}{\sum^n_{k = 0}} \binom{n}{k} = 2^n }[/math]
[math]\displaystyle{ \sum_{k = 0}^{n} \binom{n}{k} (1 - (- 1)^k) = 2 \underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^n }[/math]

Skąd natychmiast wynika

[math]\displaystyle{ \underset{k \; \text{parzyste}}{\sum_{k = 0}^{n}} \binom{n}{k} = 2^{n - 1} }[/math]
[math]\displaystyle{ \underset{k \; \text{nieparzyste}}{\sum_{k = 1}^{n}} \binom{n}{k} = 2^{n - 1} }[/math]

Co należało pokazać.



Funkcje digits(m, b) oraz issquare(m)

 

Uwaga M47
W funkcji modLucas() wykorzystaliśmy zaimplementowaną w PARI/GP funkcję

digits(m, b) – zwraca wektor cyfr liczby [math]\displaystyle{ | m | }[/math] w systemie liczbowym o podstawie [math]\displaystyle{ b }[/math]

W naszym przypadku potrzebowaliśmy uzyskać wektor cyfr liczby [math]\displaystyle{ m }[/math] w układzie dwójkowym, czyli funkcję digits(m, 2) . Wprowadzenie tej funkcji pozwoliło zwiększyć czytelność kodu, ale bez trudu możemy ją sami napisać. Zauważmy, że do zapisania liczby [math]\displaystyle{ m \geqslant 1 }[/math] potrzebujemy [math]\displaystyle{ \log_2 m + 1 }[/math] cyfr. Zastępując funkcję [math]\displaystyle{ \log_2 m }[/math] funkcją [math]\displaystyle{ \left \lfloor \tfrac{\log m}{\log 2} \right \rfloor }[/math] musimy liczyć się z możliwym błędem zaokrąglenia – dlatego w programie deklarujemy wektor V o długości floor( log(m)/log(2) ) + 2. Zwracany wektor W ma już prawidłową długość.

Dec2Bin(m) = 
\\ zwraca wektor cyfr liczby m w układzie dwójkowym
{
local(i, k, V, W);
if( m == 0, return([0]) );
V = vector( floor( log(m)/log(2) ) + 2 ); \\ potrzeba floor( log(m)/log(2) ) + 1, ale błąd zaokrąglenia może zepsuć wynik
k = 0;
while( m > 0,
       V[k++] = m % 2;
       m = floor(m / 2);
     );
W = vector(k);
for(i = 1, k, W[i] = V[k + 1 - i]);
return(W);
}


Uwaga M48
W funkcjach LucasTest() i StrongLucasTest() wykorzystaliśmy zaimplementowaną w PARI/GP funkcję

issquare(m) – sprawdza, czy liczba [math]\displaystyle{ m }[/math] jest liczbą kwadratową

Wprowadzenie tej funkcji pozwoliło zwiększyć czytelność kodu, ale bez trudu możemy ją sami napisać. Potrzebna nam będzie funkcja, która znajduje całość z pierwiastka z liczby [math]\displaystyle{ m }[/math], czyli [math]\displaystyle{ \left\lfloor \sqrt{m} \right\rfloor }[/math]. Wykorzystamy tutaj ciąg

[math]\displaystyle{ a_{k + 1} = \begin{cases} \qquad \;\; 1 & \text{gdy } k = 0 \\ \tfrac{1}{2} \left( a_k + \tfrac{x}{a_k} \right) & \text{gdy } k \gt 0 \end{cases} }[/math]

którego granicą jest [math]\displaystyle{ \sqrt{x} }[/math] [5].

Modyfikując powyższą definicję tak, aby operacje były zawsze wykonywane na liczbach całkowitych[6]

[math]\displaystyle{ a_{k + 1} = \begin{cases} \qquad \quad \; 1 & \text{gdy } k = 0 \\ \left\lfloor \tfrac{1}{2} \left( a_k + \left\lfloor \tfrac{m}{a_k} \right\rfloor \right) \right\rfloor & \text{gdy } k \gt 0 \end{cases} }[/math]

otrzymujemy ciąg, którego wszystkie wyrazy, począwszy od pewnego skończonego [math]\displaystyle{ n_0 }[/math], są równe [math]\displaystyle{ \left\lfloor \sqrt{m} \right\rfloor }[/math]. Nie dotyczy to przypadku, gdy [math]\displaystyle{ m + 1 }[/math] jest liczbą kwadratową, wtedy, począwszy od pewnego skończonego [math]\displaystyle{ n_0 }[/math], wyrazy ciągu przyjmują na zmianę wartości [math]\displaystyle{ \left\lfloor \sqrt{m} \right\rfloor }[/math] oraz [math]\displaystyle{ \left\lfloor \sqrt{m} \right\rfloor + 1 }[/math].

Na tej podstawie możemy w PARI/GP napisać funkcję

intSqrt(m) = 
{
local(a, b);
if( m == 0, return(0) );
a = 2^( floor( log(m)/log(2)/2 ) + 2 ); \\ musi być a > sqrt(m)
b = floor(( a + floor( m/a ) )/2);
while( b < a,
       a = b;
       b = floor( ( a + floor(m/a) )/2 );
     );
return(a);
}

Oczywiście liczba [math]\displaystyle{ m }[/math] jest liczbą kwadratową, wtedy i tylko wtedy, gdy [math]\displaystyle{ m = \left\lfloor \sqrt{m} \right\rfloor^2 }[/math], zatem wystarczy sprawdzić, czy m == intSqrt(m)^2.








Przypisy

  1. 1,0 1,1 Robert Baillie and Samuel S. Wagstaff Jr., Lucas Pseudoprimes, Mathematics of Computation Vol. 35, No. 152 (1980), (LINK)
  2. François Arnault, The Rabin-Monier Theorem for Lucas Pseudoprimes, Mathematics of Computation Vol. 66, No. 218 (1997)
  3. Wikipedia, Baillie–PSW primality test, (Wiki-en)
  4. MathWorld, Baillie-PSW Primality Test, (LINK)
  5. Wikipedia, Pierwiastek kwadratowy, (Wiki-pl), (Wiki-en)
  6. Wikipedia, Integer square root, (Wiki-en)