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-220x+1499
f(0)=1499
f(1)=5
f(2)=1063
f(3)=53
f(4)=127
f(5)=1
f(6)=43
f(7)=1
f(8)=197
f(9)=1
f(10)=601
f(11)=1
f(12)=997
f(13)=149
f(14)=277
f(15)=1
f(16)=353
f(17)=61
f(18)=2137
f(19)=29
f(20)=41
f(21)=67
f(22)=2857
f(23)=379
f(24)=641
f(25)=211
f(26)=709
f(27)=1
f(28)=3877
f(29)=101
f(30)=4201
f(31)=109
f(32)=4517
f(33)=73
f(34)=193
f(35)=311
f(36)=1
f(37)=659
f(38)=5417
f(39)=139
f(40)=5701
f(41)=1
f(42)=1
f(43)=191
f(44)=1249
f(45)=797
f(46)=1301
f(47)=829
f(48)=233
f(49)=1
f(50)=7001
f(51)=89
f(52)=7237
f(53)=919
f(54)=1493
f(55)=947
f(56)=1
f(57)=487
f(58)=1
f(59)=1
f(60)=8101
f(61)=1
f(62)=8297
f(63)=1049
f(64)=1697
f(65)=1
f(66)=1733
f(67)=547
f(68)=8837
f(69)=223
f(70)=9001
f(71)=227
f(72)=9157
f(73)=577
f(74)=1861
f(75)=293
f(76)=1889
f(77)=1
f(78)=157
f(79)=241
f(80)=1
f(81)=1
f(82)=9817
f(83)=617
f(84)=397
f(85)=1
f(86)=401
f(87)=1259
f(88)=151
f(89)=1
f(90)=1
f(91)=1
f(92)=239
f(93)=1289
f(94)=2069
f(95)=1297
f(96)=2081
f(97)=163
f(98)=10457
f(99)=131
b) Substitution of the polynom
The polynom f(x)=x^2-220x+1499 could be written as f(y)= y^2-10601 with x=y+110
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-110
f'(x)>2x-221 with x > 103
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 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 7 | 3 | 4 | 0.875 | 0.375 | 0.5 |
4 | 16 | 12 | 5 | 7 | 0.75 | 0.3125 | 0.4375 |
5 | 32 | 27 | 10 | 17 | 0.84375 | 0.3125 | 0.53125 |
6 | 64 | 51 | 16 | 35 | 0.796875 | 0.25 | 0.546875 |
7 | 128 | 87 | 24 | 63 | 0.6796875 | 0.1875 | 0.4921875 |
8 | 256 | 108 | 31 | 77 | 0.421875 | 0.12109375 | 0.30078125 |
9 | 512 | 273 | 71 | 202 | 0.53320313 | 0.13867188 | 0.39453125 |
10 | 1024 | 614 | 141 | 473 | 0.59960938 | 0.13769531 | 0.46191406 |
11 | 2048 | 1293 | 265 | 1028 | 0.63134766 | 0.12939453 | 0.50195313 |
12 | 4096 | 2669 | 491 | 2178 | 0.65161133 | 0.11987305 | 0.53173828 |
13 | 8192 | 5424 | 898 | 4526 | 0.66210938 | 0.10961914 | 0.55249023 |
14 | 16384 | 10922 | 1632 | 9290 | 0.66662598 | 0.09960938 | 0.5670166 |
15 | 32768 | 21962 | 3040 | 18922 | 0.67022705 | 0.09277344 | 0.57745361 |
16 | 65536 | 44105 | 5698 | 38407 | 0.67298889 | 0.08694458 | 0.58604431 |
17 | 131072 | 88620 | 10560 | 78060 | 0.67611694 | 0.08056641 | 0.59555054 |
18 | 262144 | 177599 | 19839 | 157760 | 0.67748642 | 0.07567978 | 0.60180664 |
19 | 524288 | 355680 | 37329 | 318351 | 0.67840576 | 0.07119942 | 0.60720634 |
20 | 1048576 | 712552 | 70704 | 641848 | 0.67954254 | 0.06742859 | 0.61211395 |
21 | 2097152 | 1426421 | 134087 | 1292334 | 0.68017054 | 0.06393766 | 0.61623287 |
22 | 4194304 | 2855827 | 254754 | 2601073 | 0.68088222 | 0.06073809 | 0.62014413 |
23 | 8388608 | 5715820 | 485213 | 5230607 | 0.68137884 | 0.0578419 | 0.62353694 |
24 | 16777216 | 11440459 | 927243 | 10513216 | 0.68190449 | 0.05526799 | 0.62663651 |