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-156x+347
f(0)=347
f(1)=3
f(2)=13
f(3)=7
f(4)=29
f(5)=17
f(6)=79
f(7)=1
f(8)=31
f(9)=61
f(10)=53
f(11)=1
f(12)=1381
f(13)=1
f(14)=547
f(15)=1
f(16)=631
f(17)=1
f(18)=2137
f(19)=47
f(20)=113
f(21)=311
f(22)=1
f(23)=1
f(24)=1
f(25)=1
f(26)=337
f(27)=1
f(28)=83
f(29)=139
f(30)=3433
f(31)=1
f(32)=71
f(33)=1
f(34)=181
f(35)=1
f(36)=137
f(37)=1
f(38)=197
f(39)=1
f(40)=1
f(41)=1
f(42)=4441
f(43)=1
f(44)=509
f(45)=1
f(46)=1571
f(47)=199
f(48)=691
f(49)=1
f(50)=127
f(51)=313
f(52)=241
f(53)=1
f(54)=397
f(55)=1
f(56)=103
f(57)=331
f(58)=593
f(59)=1
f(60)=5413
f(61)=227
f(62)=1
f(63)=1
f(64)=1847
f(65)=1
f(66)=1
f(67)=1
f(68)=1879
f(69)=101
f(70)=1
f(71)=1
f(72)=5701
f(73)=1
f(74)=1907
f(75)=179
f(76)=1
f(77)=239
f(78)=5737
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-156x+347 could be written as f(y)= y^2-5737 with x=y+78
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-78
f'(x)>2x-157 with x > 76
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 | 8 | 1 | 7 | 1 | 0.125 | 0.875 |
4 | 16 | 13 | 2 | 11 | 0.8125 | 0.125 | 0.6875 |
5 | 32 | 22 | 4 | 18 | 0.6875 | 0.125 | 0.5625 |
6 | 64 | 40 | 6 | 34 | 0.625 | 0.09375 | 0.53125 |
7 | 128 | 47 | 8 | 39 | 0.3671875 | 0.0625 | 0.3046875 |
8 | 256 | 86 | 14 | 72 | 0.3359375 | 0.0546875 | 0.28125 |
9 | 512 | 220 | 25 | 195 | 0.4296875 | 0.04882813 | 0.38085938 |
10 | 1024 | 514 | 46 | 468 | 0.50195313 | 0.04492188 | 0.45703125 |
11 | 2048 | 1111 | 71 | 1040 | 0.54248047 | 0.03466797 | 0.5078125 |
12 | 4096 | 2329 | 134 | 2195 | 0.56860352 | 0.03271484 | 0.53588867 |
13 | 8192 | 4796 | 267 | 4529 | 0.58544922 | 0.03259277 | 0.55285645 |
14 | 16384 | 9751 | 503 | 9248 | 0.59515381 | 0.03070068 | 0.56445313 |
15 | 32768 | 19739 | 956 | 18783 | 0.60238647 | 0.0291748 | 0.57321167 |
16 | 65536 | 39929 | 1757 | 38172 | 0.60926819 | 0.02680969 | 0.5824585 |
17 | 131072 | 80727 | 3344 | 77383 | 0.61589813 | 0.0255127 | 0.59038544 |
18 | 262144 | 162645 | 6320 | 156325 | 0.62044144 | 0.02410889 | 0.59633255 |
19 | 524288 | 327536 | 11930 | 315606 | 0.62472534 | 0.02275467 | 0.60197067 |
20 | 1048576 | 659288 | 22466 | 636822 | 0.62874603 | 0.02142525 | 0.60732079 |
21 | 2097152 | 1325346 | 42614 | 1282732 | 0.63197422 | 0.02031994 | 0.61165428 |
22 | 4194304 | 2663070 | 80682 | 2582388 | 0.63492537 | 0.01923609 | 0.61568928 |
23 | 8388608 | 5347902 | 154102 | 5193800 | 0.6375196 | 0.01837039 | 0.61914921 |
24 | 16777216 | 10737196 | 294202 | 10442994 | 0.63998675 | 0.01753581 | 0.62245095 |