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+120x-557
f(0)=557
f(1)=109
f(2)=313
f(3)=47
f(4)=61
f(5)=17
f(6)=199
f(7)=83
f(8)=467
f(9)=151
f(10)=743
f(11)=13
f(12)=79
f(13)=293
f(14)=1319
f(15)=367
f(16)=1619
f(17)=443
f(18)=41
f(19)=521
f(20)=2243
f(21)=601
f(22)=1
f(23)=683
f(24)=223
f(25)=59
f(26)=1
f(27)=853
f(28)=211
f(29)=941
f(30)=3943
f(31)=1031
f(32)=73
f(33)=1123
f(34)=4679
f(35)=1217
f(36)=5059
f(37)=101
f(38)=419
f(39)=1
f(40)=5843
f(41)=1511
f(42)=6247
f(43)=1613
f(44)=6659
f(45)=1
f(46)=7079
f(47)=1823
f(48)=7507
f(49)=1931
f(50)=1
f(51)=157
f(52)=8387
f(53)=2153
f(54)=8839
f(55)=2267
f(56)=547
f(57)=2383
f(58)=9767
f(59)=1
f(60)=10243
f(61)=2621
f(62)=631
f(63)=1
f(64)=863
f(65)=1
f(66)=11719
f(67)=1
f(68)=12227
f(69)=3121
f(70)=12743
f(71)=3251
f(72)=13267
f(73)=1
f(74)=13799
f(75)=3517
f(76)=1103
f(77)=281
f(78)=14887
f(79)=1
f(80)=15443
f(81)=3931
f(82)=16007
f(83)=4073
f(84)=1
f(85)=4217
f(86)=17159
f(87)=4363
f(88)=17747
f(89)=347
f(90)=1
f(91)=1
f(92)=18947
f(93)=4813
f(94)=19559
f(95)=4967
f(96)=1187
f(97)=1
f(98)=20807
f(99)=5281
b) Substitution of the polynom
The polynom f(x)=x^2+120x-557 could be written as f(y)= y^2-4157 with x=y-60
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+60
f'(x)>2x+119
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 | 5 | 4 | 1.125 | 0.625 | 0.5 |
4 | 16 | 17 | 8 | 9 | 1.0625 | 0.5 | 0.5625 |
5 | 32 | 31 | 10 | 21 | 0.96875 | 0.3125 | 0.65625 |
6 | 64 | 58 | 21 | 37 | 0.90625 | 0.328125 | 0.578125 |
7 | 128 | 112 | 38 | 74 | 0.875 | 0.296875 | 0.578125 |
8 | 256 | 218 | 69 | 149 | 0.8515625 | 0.26953125 | 0.58203125 |
9 | 512 | 422 | 122 | 300 | 0.82421875 | 0.23828125 | 0.5859375 |
10 | 1024 | 834 | 213 | 621 | 0.81445313 | 0.20800781 | 0.60644531 |
11 | 2048 | 1612 | 405 | 1207 | 0.78710938 | 0.19775391 | 0.58935547 |
12 | 4096 | 3189 | 726 | 2463 | 0.77856445 | 0.17724609 | 0.60131836 |
13 | 8192 | 6260 | 1347 | 4913 | 0.76416016 | 0.16442871 | 0.59973145 |
14 | 16384 | 12432 | 2428 | 10004 | 0.75878906 | 0.14819336 | 0.6105957 |
15 | 32768 | 24694 | 4517 | 20177 | 0.75360107 | 0.1378479 | 0.61575317 |
16 | 65536 | 49026 | 8430 | 40596 | 0.74807739 | 0.12863159 | 0.6194458 |
17 | 131072 | 97534 | 15721 | 81813 | 0.74412537 | 0.11994171 | 0.62418365 |
18 | 262144 | 194061 | 29538 | 164523 | 0.74028397 | 0.11267853 | 0.62760544 |
19 | 524288 | 386601 | 55659 | 330942 | 0.73738289 | 0.10616112 | 0.63122177 |
20 | 1048576 | 770717 | 105175 | 665542 | 0.73501301 | 0.1003027 | 0.63471031 |
21 | 2097152 | 1536531 | 199467 | 1337064 | 0.73267508 | 0.09511328 | 0.6375618 |
22 | 4194304 | 3065070 | 378842 | 2686228 | 0.73076963 | 0.09032297 | 0.64044666 |
23 | 8388608 | 6114977 | 722313 | 5392664 | 0.72896206 | 0.08610642 | 0.64285564 |
24 | 16777216 | 12202434 | 1379789 | 10822645 | 0.72732174 | 0.08224183 | 0.64507991 |