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-20x+563
f(0)=563
f(1)=17
f(2)=31
f(3)=1
f(4)=499
f(5)=61
f(6)=479
f(7)=59
f(8)=467
f(9)=29
f(10)=463
f(11)=1
f(12)=1
f(13)=1
f(14)=1
f(15)=1
f(16)=1
f(17)=1
f(18)=1
f(19)=1
f(20)=1
f(21)=73
f(22)=607
f(23)=79
f(24)=659
f(25)=43
f(26)=719
f(27)=47
f(28)=787
f(29)=103
f(30)=863
f(31)=113
f(32)=947
f(33)=1
f(34)=1039
f(35)=1
f(36)=67
f(37)=149
f(38)=1
f(39)=163
f(40)=1
f(41)=89
f(42)=1487
f(43)=97
f(44)=1619
f(45)=211
f(46)=1759
f(47)=229
f(48)=1907
f(49)=1
f(50)=2063
f(51)=1
f(52)=131
f(53)=1
f(54)=2399
f(55)=311
f(56)=2579
f(57)=167
f(58)=2767
f(59)=179
f(60)=2963
f(61)=383
f(62)=3167
f(63)=409
f(64)=109
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=239
f(71)=523
f(72)=1
f(73)=277
f(74)=1
f(75)=293
f(76)=1
f(77)=619
f(78)=5087
f(79)=653
f(80)=173
f(81)=1
f(82)=5647
f(83)=181
f(84)=5939
f(85)=761
f(86)=367
f(87)=1
f(88)=6547
f(89)=419
f(90)=6863
f(91)=439
f(92)=7187
f(93)=919
f(94)=1
f(95)=1
f(96)=271
f(97)=251
f(98)=283
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-20x+563 could be written as f(y)= y^2+463 with x=y+10
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-10
f'(x)>2x-21 with x > 22
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 | 1 | 2 | 1.5 | 0.5 | 1 |
2 | 4 | 4 | 2 | 2 | 1 | 0.5 | 0.5 |
3 | 8 | 8 | 4 | 4 | 1 | 0.5 | 0.5 |
4 | 16 | 10 | 5 | 5 | 0.625 | 0.3125 | 0.3125 |
5 | 32 | 22 | 11 | 11 | 0.6875 | 0.34375 | 0.34375 |
6 | 64 | 47 | 22 | 25 | 0.734375 | 0.34375 | 0.390625 |
7 | 128 | 90 | 37 | 53 | 0.703125 | 0.2890625 | 0.4140625 |
8 | 256 | 178 | 65 | 113 | 0.6953125 | 0.25390625 | 0.44140625 |
9 | 512 | 352 | 109 | 243 | 0.6875 | 0.21289063 | 0.47460938 |
10 | 1024 | 696 | 206 | 490 | 0.6796875 | 0.20117188 | 0.47851563 |
11 | 2048 | 1390 | 374 | 1016 | 0.67871094 | 0.18261719 | 0.49609375 |
12 | 4096 | 2791 | 681 | 2110 | 0.68139648 | 0.16625977 | 0.51513672 |
13 | 8192 | 5592 | 1224 | 4368 | 0.68261719 | 0.14941406 | 0.53320313 |
14 | 16384 | 11203 | 2270 | 8933 | 0.68377686 | 0.1385498 | 0.54522705 |
15 | 32768 | 22445 | 4181 | 18264 | 0.68496704 | 0.12759399 | 0.55737305 |
16 | 65536 | 44990 | 7798 | 37192 | 0.68649292 | 0.11898804 | 0.56750488 |
17 | 131072 | 90110 | 14538 | 75572 | 0.68748474 | 0.11091614 | 0.5765686 |
18 | 262144 | 180304 | 27149 | 153155 | 0.68780518 | 0.10356522 | 0.58423996 |
19 | 524288 | 360909 | 51432 | 309477 | 0.68837929 | 0.09809875 | 0.59028053 |
20 | 1048576 | 722329 | 97057 | 625272 | 0.68886662 | 0.09256077 | 0.59630585 |
21 | 2097152 | 1444979 | 184365 | 1260614 | 0.68901968 | 0.08791208 | 0.6011076 |
22 | 4194304 | 2890122 | 350612 | 2539510 | 0.68905878 | 0.08359241 | 0.60546637 |
23 | 8388608 | 5781329 | 669503 | 5111826 | 0.68918812 | 0.07981098 | 0.60937715 |
24 | 16777216 | 11565506 | 1277883 | 10287623 | 0.68935788 | 0.07616776 | 0.61319011 |