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-88x+983
f(0)=983
f(1)=7
f(2)=811
f(3)=13
f(4)=647
f(5)=71
f(6)=491
f(7)=1
f(8)=1
f(9)=17
f(10)=29
f(11)=1
f(12)=1
f(13)=1
f(14)=53
f(15)=1
f(16)=1
f(17)=1
f(18)=277
f(19)=41
f(20)=1
f(21)=1
f(22)=67
f(23)=1
f(24)=79
f(25)=37
f(26)=1
f(27)=83
f(28)=1
f(29)=1
f(30)=757
f(31)=1
f(32)=809
f(33)=1
f(34)=853
f(35)=109
f(36)=127
f(37)=113
f(38)=131
f(39)=1
f(40)=937
f(41)=59
f(42)=73
f(43)=1
f(44)=953
f(45)=1
f(46)=1
f(47)=1
f(48)=1
f(49)=1
f(50)=1
f(51)=1
f(52)=1
f(53)=1
f(54)=1
f(55)=1
f(56)=1
f(57)=1
f(58)=1
f(59)=1
f(60)=1
f(61)=1
f(62)=1
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)=1163
f(91)=157
f(92)=193
f(93)=181
f(94)=1
f(95)=103
f(96)=1
f(97)=1
f(98)=151
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-88x+983 could be written as f(y)= y^2-953 with x=y+44
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-44
f'(x)>2x-89 with x > 31
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 | 7 | 4 | 3 | 0.875 | 0.5 | 0.375 |
4 | 16 | 10 | 5 | 5 | 0.625 | 0.3125 | 0.3125 |
5 | 32 | 18 | 8 | 10 | 0.5625 | 0.25 | 0.3125 |
6 | 64 | 27 | 11 | 16 | 0.421875 | 0.171875 | 0.25 |
7 | 128 | 50 | 18 | 32 | 0.390625 | 0.140625 | 0.25 |
8 | 256 | 125 | 37 | 88 | 0.48828125 | 0.14453125 | 0.34375 |
9 | 512 | 286 | 72 | 214 | 0.55859375 | 0.140625 | 0.41796875 |
10 | 1024 | 609 | 127 | 482 | 0.59472656 | 0.12402344 | 0.47070313 |
11 | 2048 | 1261 | 247 | 1014 | 0.61572266 | 0.12060547 | 0.49511719 |
12 | 4096 | 2607 | 447 | 2160 | 0.63647461 | 0.10913086 | 0.52734375 |
13 | 8192 | 5294 | 814 | 4480 | 0.64624023 | 0.09936523 | 0.546875 |
14 | 16384 | 10646 | 1505 | 9141 | 0.64978027 | 0.09185791 | 0.55792236 |
15 | 32768 | 21438 | 2771 | 18667 | 0.65423584 | 0.08456421 | 0.56967163 |
16 | 65536 | 43062 | 5172 | 37890 | 0.65707397 | 0.07891846 | 0.57815552 |
17 | 131072 | 86465 | 9633 | 76832 | 0.6596756 | 0.07349396 | 0.58618164 |
18 | 262144 | 173483 | 18020 | 155463 | 0.66178513 | 0.06874084 | 0.59304428 |
19 | 524288 | 348002 | 34058 | 313944 | 0.66376114 | 0.06496048 | 0.59880066 |
20 | 1048576 | 697523 | 64528 | 632995 | 0.66520977 | 0.0615387 | 0.60367107 |
21 | 2097152 | 1398216 | 122413 | 1275803 | 0.66672134 | 0.05837107 | 0.60835028 |
22 | 4194304 | 2801709 | 232500 | 2569209 | 0.66797948 | 0.05543232 | 0.61254716 |
23 | 8388608 | 5613118 | 442823 | 5170295 | 0.66913581 | 0.05278862 | 0.61634719 |
24 | 16777216 | 11243134 | 845315 | 10397819 | 0.67014301 | 0.0503847 | 0.61975831 |