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-124x-613
f(0)=613
f(1)=23
f(2)=857
f(3)=61
f(4)=1093
f(5)=151
f(6)=1321
f(7)=179
f(8)=67
f(9)=103
f(10)=1753
f(11)=29
f(12)=19
f(13)=257
f(14)=2153
f(15)=281
f(16)=2341
f(17)=1
f(18)=2521
f(19)=163
f(20)=2693
f(21)=347
f(22)=2857
f(23)=367
f(24)=131
f(25)=193
f(26)=109
f(27)=101
f(28)=3301
f(29)=421
f(30)=3433
f(31)=1
f(32)=3557
f(33)=113
f(34)=3673
f(35)=233
f(36)=199
f(37)=479
f(38)=3881
f(39)=491
f(40)=137
f(41)=251
f(42)=4057
f(43)=1
f(44)=4133
f(45)=521
f(46)=4201
f(47)=1
f(48)=4261
f(49)=1
f(50)=227
f(51)=271
f(52)=4357
f(53)=547
f(54)=191
f(55)=1
f(56)=4421
f(57)=277
f(58)=4441
f(59)=139
f(60)=73
f(61)=557
f(62)=4457
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=1
f(75)=1
f(76)=1
f(77)=1
f(78)=1
f(79)=1
f(80)=1
f(81)=1
f(82)=1
f(83)=1
f(84)=1
f(85)=1
f(86)=1
f(87)=1
f(88)=1
f(89)=1
f(90)=1
f(91)=1
f(92)=1
f(93)=1
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=1
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-124x-613 could be written as f(y)= y^2-4457 with x=y+62
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-62
f'(x)>2x-125 with x > 67
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 | 7 | 10 | 1.0625 | 0.4375 | 0.625 |
5 | 32 | 31 | 13 | 18 | 0.96875 | 0.40625 | 0.5625 |
6 | 64 | 57 | 23 | 34 | 0.890625 | 0.359375 | 0.53125 |
7 | 128 | 57 | 23 | 34 | 0.4453125 | 0.1796875 | 0.265625 |
8 | 256 | 148 | 62 | 86 | 0.578125 | 0.2421875 | 0.3359375 |
9 | 512 | 330 | 116 | 214 | 0.64453125 | 0.2265625 | 0.41796875 |
10 | 1024 | 694 | 222 | 472 | 0.67773438 | 0.21679688 | 0.4609375 |
11 | 2048 | 1428 | 411 | 1017 | 0.69726563 | 0.20068359 | 0.49658203 |
12 | 4096 | 2866 | 753 | 2113 | 0.69970703 | 0.18383789 | 0.51586914 |
13 | 8192 | 5752 | 1345 | 4407 | 0.70214844 | 0.16418457 | 0.53796387 |
14 | 16384 | 11531 | 2505 | 9026 | 0.70379639 | 0.15289307 | 0.55090332 |
15 | 32768 | 23080 | 4636 | 18444 | 0.7043457 | 0.14147949 | 0.56286621 |
16 | 65536 | 46122 | 8683 | 37439 | 0.70376587 | 0.13249207 | 0.5712738 |
17 | 131072 | 92280 | 16099 | 76181 | 0.70404053 | 0.12282562 | 0.5812149 |
18 | 262144 | 184460 | 30283 | 154177 | 0.70365906 | 0.11552048 | 0.58813858 |
19 | 524288 | 368565 | 57264 | 311301 | 0.70298195 | 0.10922241 | 0.59375954 |
20 | 1048576 | 736658 | 108102 | 628556 | 0.70253181 | 0.1030941 | 0.59943771 |
21 | 2097152 | 1472550 | 205112 | 1267438 | 0.70216656 | 0.09780502 | 0.60436153 |
22 | 4194304 | 2943637 | 390077 | 2553560 | 0.70181775 | 0.0930016 | 0.60881615 |
23 | 8388608 | 5884286 | 743310 | 5140976 | 0.70146155 | 0.08860946 | 0.6128521 |
24 | 16777216 | 11761893 | 1420374 | 10341519 | 0.70106345 | 0.08466089 | 0.61640257 |