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+136x-349
f(0)=349
f(1)=53
f(2)=73
f(3)=17
f(4)=211
f(5)=89
f(6)=503
f(7)=163
f(8)=11
f(9)=239
f(10)=101
f(11)=317
f(12)=1427
f(13)=397
f(14)=103
f(15)=479
f(16)=2083
f(17)=563
f(18)=2423
f(19)=59
f(20)=1
f(21)=67
f(22)=1
f(23)=827
f(24)=3491
f(25)=919
f(26)=3863
f(27)=1013
f(28)=4243
f(29)=1109
f(30)=421
f(31)=71
f(32)=457
f(33)=1307
f(34)=5431
f(35)=1409
f(36)=5843
f(37)=1
f(38)=6263
f(39)=1619
f(40)=6691
f(41)=157
f(42)=7127
f(43)=167
f(44)=113
f(45)=1949
f(46)=1
f(47)=2063
f(48)=499
f(49)=2179
f(50)=8951
f(51)=2297
f(52)=857
f(53)=2417
f(54)=1
f(55)=2539
f(56)=1
f(57)=2663
f(58)=10903
f(59)=2789
f(60)=11411
f(61)=2917
f(62)=11927
f(63)=277
f(64)=12451
f(65)=1
f(66)=12983
f(67)=3313
f(68)=13523
f(69)=3449
f(70)=14071
f(71)=1
f(72)=14627
f(73)=3727
f(74)=1381
f(75)=1
f(76)=1433
f(77)=4013
f(78)=1
f(79)=4159
f(80)=16931
f(81)=1
f(82)=1031
f(83)=4457
f(84)=18131
f(85)=419
f(86)=18743
f(87)=433
f(88)=1
f(89)=4919
f(90)=19991
f(91)=5077
f(92)=20627
f(93)=5237
f(94)=1
f(95)=5399
f(96)=1993
f(97)=5563
f(98)=2053
f(99)=337
b) Substitution of the polynom
The polynom f(x)=x^2+136x-349 could be written as f(y)= y^2-4973 with x=y-68
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+68
f'(x)>2x+135
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 | 17 | 6 | 11 | 1.0625 | 0.375 | 0.6875 |
5 | 32 | 31 | 10 | 21 | 0.96875 | 0.3125 | 0.65625 |
6 | 64 | 59 | 20 | 39 | 0.921875 | 0.3125 | 0.609375 |
7 | 128 | 111 | 37 | 74 | 0.8671875 | 0.2890625 | 0.578125 |
8 | 256 | 221 | 68 | 153 | 0.86328125 | 0.265625 | 0.59765625 |
9 | 512 | 430 | 126 | 304 | 0.83984375 | 0.24609375 | 0.59375 |
10 | 1024 | 845 | 225 | 620 | 0.82519531 | 0.21972656 | 0.60546875 |
11 | 2048 | 1654 | 402 | 1252 | 0.80761719 | 0.19628906 | 0.61132813 |
12 | 4096 | 3246 | 738 | 2508 | 0.79248047 | 0.18017578 | 0.61230469 |
13 | 8192 | 6361 | 1366 | 4995 | 0.77648926 | 0.16674805 | 0.60974121 |
14 | 16384 | 12608 | 2491 | 10117 | 0.76953125 | 0.15203857 | 0.61749268 |
15 | 32768 | 25053 | 4594 | 20459 | 0.76455688 | 0.14019775 | 0.62435913 |
16 | 65536 | 49660 | 8623 | 41037 | 0.75775146 | 0.13157654 | 0.62617493 |
17 | 131072 | 98765 | 16131 | 82634 | 0.75351715 | 0.12306976 | 0.63044739 |
18 | 262144 | 196464 | 30266 | 166198 | 0.74945068 | 0.11545563 | 0.63399506 |
19 | 524288 | 390893 | 57055 | 333838 | 0.74556923 | 0.10882378 | 0.63674545 |
20 | 1048576 | 778762 | 107908 | 670854 | 0.74268532 | 0.10290909 | 0.63977623 |
21 | 2097152 | 1552359 | 204516 | 1347843 | 0.74022245 | 0.09752083 | 0.64270163 |
22 | 4194304 | 3094860 | 388889 | 2705971 | 0.73787212 | 0.09271836 | 0.64515376 |
23 | 8388608 | 6171691 | 741240 | 5430451 | 0.7357229 | 0.08836269 | 0.64736021 |
24 | 16777216 | 12310607 | 1415438 | 10895169 | 0.73376936 | 0.08436668 | 0.64940268 |