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-180x+227
f(0)=227
f(1)=3
f(2)=43
f(3)=19
f(4)=53
f(5)=1
f(6)=1
f(7)=41
f(8)=383
f(9)=1
f(10)=491
f(11)=17
f(12)=1789
f(13)=1
f(14)=233
f(15)=281
f(16)=47
f(17)=1
f(18)=2689
f(19)=59
f(20)=991
f(21)=389
f(22)=1
f(23)=1
f(24)=3517
f(25)=1
f(26)=1259
f(27)=61
f(28)=79
f(29)=173
f(30)=4273
f(31)=1
f(32)=167
f(33)=1
f(34)=1579
f(35)=101
f(36)=4957
f(37)=211
f(38)=1723
f(39)=659
f(40)=199
f(41)=1
f(42)=5569
f(43)=1
f(44)=1
f(45)=1
f(46)=1979
f(47)=251
f(48)=149
f(49)=1
f(50)=1
f(51)=397
f(52)=2143
f(53)=271
f(54)=6577
f(55)=277
f(56)=2239
f(57)=1
f(58)=761
f(59)=1
f(60)=367
f(61)=293
f(62)=139
f(63)=1
f(64)=2399
f(65)=151
f(66)=7297
f(67)=1
f(68)=821
f(69)=929
f(70)=1
f(71)=313
f(72)=7549
f(73)=1
f(74)=2539
f(75)=239
f(76)=853
f(77)=107
f(78)=131
f(79)=1
f(80)=2591
f(81)=487
f(82)=137
f(83)=163
f(84)=461
f(85)=109
f(86)=97
f(87)=983
f(88)=1
f(89)=1
f(90)=7873
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-180x+227 could be written as f(y)= y^2-7873 with x=y+90
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-90
f'(x)>2x-181 with x > 89
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 | 5 | 1 | 4 | 1.25 | 0.25 | 1 |
3 | 8 | 7 | 1 | 6 | 0.875 | 0.125 | 0.75 |
4 | 16 | 13 | 2 | 11 | 0.8125 | 0.125 | 0.6875 |
5 | 32 | 24 | 5 | 19 | 0.75 | 0.15625 | 0.59375 |
6 | 64 | 46 | 8 | 38 | 0.71875 | 0.125 | 0.59375 |
7 | 128 | 66 | 11 | 55 | 0.515625 | 0.0859375 | 0.4296875 |
8 | 256 | 96 | 16 | 80 | 0.375 | 0.0625 | 0.3125 |
9 | 512 | 244 | 32 | 212 | 0.4765625 | 0.0625 | 0.4140625 |
10 | 1024 | 543 | 69 | 474 | 0.53027344 | 0.06738281 | 0.46289063 |
11 | 2048 | 1172 | 120 | 1052 | 0.57226563 | 0.05859375 | 0.51367188 |
12 | 4096 | 2451 | 214 | 2237 | 0.59838867 | 0.05224609 | 0.54614258 |
13 | 8192 | 5018 | 400 | 4618 | 0.61254883 | 0.04882813 | 0.5637207 |
14 | 16384 | 10206 | 751 | 9455 | 0.6229248 | 0.0458374 | 0.5770874 |
15 | 32768 | 20675 | 1392 | 19283 | 0.63095093 | 0.04248047 | 0.58847046 |
16 | 65536 | 41758 | 2580 | 39178 | 0.63717651 | 0.03936768 | 0.59780884 |
17 | 131072 | 84011 | 4826 | 79185 | 0.64095306 | 0.03681946 | 0.60413361 |
18 | 262144 | 168926 | 9073 | 159853 | 0.64440155 | 0.03461075 | 0.6097908 |
19 | 524288 | 339504 | 17036 | 322468 | 0.64755249 | 0.03249359 | 0.6150589 |
20 | 1048576 | 681487 | 32283 | 649204 | 0.64991665 | 0.03078747 | 0.61912918 |
21 | 2097152 | 1367406 | 61161 | 1306245 | 0.65202999 | 0.02916384 | 0.62286615 |
22 | 4194304 | 2742545 | 116477 | 2626068 | 0.65387368 | 0.02777028 | 0.6261034 |
23 | 8388608 | 5499518 | 221850 | 5277668 | 0.65559363 | 0.02644658 | 0.62914705 |
24 | 16777216 | 11026355 | 424116 | 10602239 | 0.65722197 | 0.02527928 | 0.63194269 |