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+80x-1657
f(0)=1657
f(1)=197
f(2)=1493
f(3)=11
f(4)=1321
f(5)=7
f(6)=163
f(7)=131
f(8)=953
f(9)=107
f(10)=757
f(11)=41
f(12)=79
f(13)=1
f(14)=31
f(15)=29
f(16)=1
f(17)=1
f(18)=1
f(19)=1
f(20)=1
f(21)=1
f(22)=587
f(23)=89
f(24)=839
f(25)=1
f(26)=157
f(27)=1
f(28)=1367
f(29)=47
f(30)=53
f(31)=223
f(32)=1
f(33)=37
f(34)=317
f(35)=1
f(36)=229
f(37)=167
f(38)=257
f(39)=373
f(40)=449
f(41)=59
f(42)=3467
f(43)=227
f(44)=1
f(45)=1
f(46)=4139
f(47)=1
f(48)=641
f(49)=1
f(50)=1
f(51)=1
f(52)=127
f(53)=337
f(54)=797
f(55)=103
f(56)=101
f(57)=769
f(58)=577
f(59)=409
f(60)=613
f(61)=1
f(62)=1021
f(63)=919
f(64)=7559
f(65)=971
f(66)=1
f(67)=1
f(68)=1201
f(69)=1
f(70)=239
f(71)=1
f(72)=251
f(73)=1
f(74)=9739
f(75)=1
f(76)=1
f(77)=1
f(78)=10667
f(79)=1
f(80)=1013
f(81)=1423
f(82)=151
f(83)=1
f(84)=12119
f(85)=773
f(86)=12619
f(87)=1609
f(88)=13127
f(89)=1
f(90)=1949
f(91)=1
f(92)=457
f(93)=1
f(94)=14699
f(95)=1871
f(96)=311
f(97)=277
f(98)=15787
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+80x-1657 could be written as f(y)= y^2-3257 with x=y-40
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+40
f'(x)>2x+79
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 | 15 | 5 | 10 | 0.9375 | 0.3125 | 0.625 |
5 | 32 | 23 | 8 | 15 | 0.71875 | 0.25 | 0.46875 |
6 | 64 | 47 | 11 | 36 | 0.734375 | 0.171875 | 0.5625 |
7 | 128 | 84 | 21 | 63 | 0.65625 | 0.1640625 | 0.4921875 |
8 | 256 | 166 | 40 | 126 | 0.6484375 | 0.15625 | 0.4921875 |
9 | 512 | 325 | 76 | 249 | 0.63476563 | 0.1484375 | 0.48632813 |
10 | 1024 | 646 | 133 | 513 | 0.63085938 | 0.12988281 | 0.50097656 |
11 | 2048 | 1309 | 249 | 1060 | 0.63916016 | 0.12158203 | 0.51757813 |
12 | 4096 | 2633 | 447 | 2186 | 0.64282227 | 0.10913086 | 0.53369141 |
13 | 8192 | 5293 | 835 | 4458 | 0.64611816 | 0.10192871 | 0.54418945 |
14 | 16384 | 10652 | 1501 | 9151 | 0.65014648 | 0.09161377 | 0.55853271 |
15 | 32768 | 21428 | 2773 | 18655 | 0.65393066 | 0.08462524 | 0.56930542 |
16 | 65536 | 43004 | 5176 | 37828 | 0.65618896 | 0.07897949 | 0.57720947 |
17 | 131072 | 86262 | 9748 | 76514 | 0.65812683 | 0.07437134 | 0.58375549 |
18 | 262144 | 173090 | 18222 | 154868 | 0.66028595 | 0.06951141 | 0.59077454 |
19 | 524288 | 347167 | 34153 | 313014 | 0.6621685 | 0.06514168 | 0.59702682 |
20 | 1048576 | 695791 | 64864 | 630927 | 0.66355801 | 0.06185913 | 0.60169888 |
21 | 2097152 | 1394458 | 122999 | 1271459 | 0.66492939 | 0.05865049 | 0.6062789 |
22 | 4194304 | 2794731 | 233416 | 2561315 | 0.66631579 | 0.05565071 | 0.61066508 |
23 | 8388608 | 5599323 | 445181 | 5154142 | 0.66749132 | 0.05306971 | 0.61442161 |
24 | 16777216 | 11218103 | 849766 | 10368337 | 0.66865104 | 0.05065 | 0.61800104 |