Development of |
|
liste_max:=100000; sieving:=proc (stelle, p) begin while (stelle<=liste_max) do erg:=liste[stelle]; while(erg mod p=0) do // Divison of the stored f(x) by the prime erg:=erg /p; end_while; liste[stelle]:=erg; stelle:=stelle+p; end_while; end_proc; // Calculation of the values of the polynom for x from 0 to liste_max for x from 0 to liste_max do p:=abs (a*x^2+b*x+c); while (p mod 2=0) p:=p/2; liste [x]:=p; end_for; for x from 0 to liste_max do p:=liste[x]; if (p>1) then // Printing the Primes print (x, p); // 1. Sieving sieving (x+p, p); t:=(-x-b/a) mod p;If you are interested in some better algorithms have a look at quadr_Sieb_x^2+1.php.
if t=0 then t:=p; end_if; // 2. Sieving sieving (t, p); end_if; end_for;
2. Mathematical background
Lemma: If p | f(x) then also p | f(x+p) and p | f(-x-b/a) a) p | f(x) <=> ax^2 + bx + c = 0 mod p p | f(x+p) <=> a(x+p)^2 + b(x+p) + c = 0 mod p <=> ax^2 + 2axp + ap^2 + bx + bp + c = 0 mod p <=> ax^2 + bx + c = 0 mod p Thus if p | f(x) then p | f(x+p) b) if b = 0 mod a p | f(x) <=> ax^2 + bx + c = 0 mod p p | f(-x-b/a) <=> a(-x-b/a)^2 + b(-x-b/a) + c = 0 mod p <=> ax^2 + 2bx + b^2/a - bx - b^2/a + c = 0 mod p <=> ax^2 + bx + c = 0 mod p Thus if p | f(x) then p | f(-x-b/a)3. Correctness of the algorithm
The proof for this polynom is similar to the proof for the polynom f(x)=x^2-4x+1. a) First terms for the polynom f(x) = x^2-358x+773
f(0)=773
f(1)=13
f(2)=61
f(3)=73
f(4)=643
f(5)=31
f(6)=103
f(7)=421
f(8)=2027
f(9)=37
f(10)=2707
f(11)=761
f(12)=109
f(13)=29
f(14)=311
f(15)=1093
f(16)=127
f(17)=157
f(18)=5347
f(19)=1
f(20)=5987
f(21)=197
f(22)=6619
f(23)=1733
f(24)=7243
f(25)=59
f(26)=271
f(27)=1
f(28)=8467
f(29)=137
f(30)=9067
f(31)=2341
f(32)=743
f(33)=1
f(34)=10243
f(35)=2633
f(36)=349
f(37)=347
f(38)=193
f(39)=2917
f(40)=919
f(41)=191
f(42)=431
f(43)=1
f(44)=13043
f(45)=1
f(46)=367
f(47)=3461
f(48)=14107
f(49)=449
f(50)=14627
f(51)=1
f(52)=15139
f(53)=1
f(54)=15643
f(55)=1
f(56)=16139
f(57)=1
f(58)=1279
f(59)=4217
f(60)=17107
f(61)=1
f(62)=17579
f(63)=1
f(64)=18043
f(65)=571
f(66)=1423
f(67)=151
f(68)=18947
f(69)=599
f(70)=19387
f(71)=1
f(72)=19819
f(73)=313
f(74)=653
f(75)=5113
f(76)=283
f(77)=163
f(78)=21067
f(79)=409
f(80)=21467
f(81)=677
f(82)=21859
f(83)=149
f(84)=1
f(85)=701
f(86)=22619
f(87)=5701
f(88)=181
f(89)=1
f(90)=631
f(91)=5881
f(92)=1823
f(93)=373
f(94)=24043
f(95)=6053
f(96)=24379
f(97)=1
f(98)=797
f(99)=6217
b) Substitution of the polynom
The polynom f(x)=x^2-358x+773 could be written as f(y)= y^2-31268 with x=y+179
c) Backsubstitution Beside by backsubstitution you get an estimation for the huge of the primes with p | f(x) and p < f(x) f'(y)>(2y-1) with with y=x-179
f'(x)>2x-359 with x > 177
A | B | C | D | E | F | G | H |
exponent =log2 (x) |
<=x | number of all primes |
number of primes p = f(x) |
number of primes p | f(x) |
C / x | D / x | E / x |
1 | 2 | 3 | 2 | 1 | 1.5 | 1 | 0.5 |
2 | 4 | 5 | 3 | 2 | 1.25 | 0.75 | 0.5 |
3 | 8 | 9 | 4 | 5 | 1.125 | 0.5 | 0.625 |
4 | 16 | 17 | 5 | 12 | 1.0625 | 0.3125 | 0.75 |
5 | 32 | 31 | 11 | 20 | 0.96875 | 0.34375 | 0.625 |
6 | 64 | 54 | 21 | 33 | 0.84375 | 0.328125 | 0.515625 |
7 | 128 | 107 | 37 | 70 | 0.8359375 | 0.2890625 | 0.546875 |
8 | 256 | 151 | 49 | 102 | 0.58984375 | 0.19140625 | 0.3984375 |
9 | 512 | 250 | 87 | 163 | 0.48828125 | 0.16992188 | 0.31835938 |
10 | 1024 | 609 | 188 | 421 | 0.59472656 | 0.18359375 | 0.41113281 |
11 | 2048 | 1326 | 371 | 955 | 0.64746094 | 0.18115234 | 0.46630859 |
12 | 4096 | 2750 | 712 | 2038 | 0.67138672 | 0.17382813 | 0.49755859 |
13 | 8192 | 5623 | 1275 | 4348 | 0.68640137 | 0.15563965 | 0.53076172 |
14 | 16384 | 11352 | 2347 | 9005 | 0.69287109 | 0.14324951 | 0.54962158 |
15 | 32768 | 22815 | 4364 | 18451 | 0.69625854 | 0.13317871 | 0.56307983 |
16 | 65536 | 45684 | 8162 | 37522 | 0.69708252 | 0.12454224 | 0.57254028 |
17 | 131072 | 91508 | 15284 | 76224 | 0.69815063 | 0.11660767 | 0.58154297 |
18 | 262144 | 183081 | 28777 | 154304 | 0.69839859 | 0.10977554 | 0.58862305 |
19 | 524288 | 366119 | 54122 | 311997 | 0.69831657 | 0.10322952 | 0.59508705 |
20 | 1048576 | 732112 | 102499 | 629613 | 0.69819641 | 0.09775066 | 0.60044575 |
21 | 2097152 | 1464144 | 194270 | 1269874 | 0.69815826 | 0.09263515 | 0.60552311 |
22 | 4194304 | 2927323 | 369547 | 2557776 | 0.69792819 | 0.08810687 | 0.60982132 |
23 | 8388608 | 5853389 | 704661 | 5148728 | 0.69777834 | 0.08400214 | 0.61377621 |
24 | 16777216 | 11703799 | 1346476 | 10357323 | 0.69760078 | 0.08025622 | 0.61734456 |