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+16x-193
f(0)=193
f(1)=11
f(2)=157
f(3)=17
f(4)=113
f(5)=1
f(6)=61
f(7)=1
f(8)=1
f(9)=1
f(10)=67
f(11)=13
f(12)=1
f(13)=23
f(14)=227
f(15)=1
f(16)=29
f(17)=1
f(18)=419
f(19)=59
f(20)=31
f(21)=73
f(22)=643
f(23)=1
f(24)=1
f(25)=1
f(26)=1
f(27)=1
f(28)=1039
f(29)=139
f(30)=1187
f(31)=79
f(32)=1
f(33)=89
f(34)=137
f(35)=199
f(36)=1
f(37)=1
f(38)=1
f(39)=1
f(40)=1
f(41)=1
f(42)=2243
f(43)=293
f(44)=2447
f(45)=1
f(46)=2659
f(47)=173
f(48)=2879
f(49)=1
f(50)=239
f(51)=1
f(52)=3343
f(53)=433
f(54)=211
f(55)=1
f(56)=349
f(57)=1
f(58)=4099
f(59)=1
f(60)=397
f(61)=563
f(62)=4643
f(63)=1
f(64)=379
f(65)=317
f(66)=307
f(67)=1
f(68)=5519
f(69)=709
f(70)=5827
f(71)=1
f(72)=6143
f(73)=197
f(74)=223
f(75)=829
f(76)=523
f(77)=1
f(78)=1
f(79)=457
f(80)=7487
f(81)=479
f(82)=1
f(83)=1
f(84)=283
f(85)=1049
f(86)=373
f(87)=1
f(88)=1
f(89)=1
f(90)=719
f(91)=1193
f(92)=9743
f(93)=1
f(94)=1
f(95)=647
f(96)=10559
f(97)=673
f(98)=10979
f(99)=1399
b) Substitution of the polynom
The polynom f(x)=x^2+16x-193 could be written as f(y)= y^2-257 with x=y-8
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+8
f'(x)>2x+15
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 | 6 | 4 | 2 | 0.75 | 0.5 | 0.25 |
4 | 16 | 11 | 6 | 5 | 0.6875 | 0.375 | 0.3125 |
5 | 32 | 20 | 10 | 10 | 0.625 | 0.3125 | 0.3125 |
6 | 64 | 39 | 17 | 22 | 0.609375 | 0.265625 | 0.34375 |
7 | 128 | 78 | 30 | 48 | 0.609375 | 0.234375 | 0.375 |
8 | 256 | 161 | 54 | 107 | 0.62890625 | 0.2109375 | 0.41796875 |
9 | 512 | 330 | 88 | 242 | 0.64453125 | 0.171875 | 0.47265625 |
10 | 1024 | 670 | 155 | 515 | 0.65429688 | 0.15136719 | 0.50292969 |
11 | 2048 | 1353 | 292 | 1061 | 0.66064453 | 0.14257813 | 0.51806641 |
12 | 4096 | 2715 | 521 | 2194 | 0.6628418 | 0.12719727 | 0.53564453 |
13 | 8192 | 5443 | 966 | 4477 | 0.66442871 | 0.11791992 | 0.54650879 |
14 | 16384 | 10923 | 1755 | 9168 | 0.66668701 | 0.1071167 | 0.55957031 |
15 | 32768 | 21917 | 3219 | 18698 | 0.66885376 | 0.09823608 | 0.57061768 |
16 | 65536 | 43991 | 5965 | 38026 | 0.67124939 | 0.09101868 | 0.58023071 |
17 | 131072 | 88224 | 11099 | 77125 | 0.6730957 | 0.08467865 | 0.58841705 |
18 | 262144 | 176564 | 20824 | 155740 | 0.67353821 | 0.07943726 | 0.59410095 |
19 | 524288 | 353772 | 39220 | 314552 | 0.67476654 | 0.07480621 | 0.59996033 |
20 | 1048576 | 708386 | 74193 | 634193 | 0.67556953 | 0.07075596 | 0.60481358 |
21 | 2097152 | 1418555 | 140422 | 1278133 | 0.67641973 | 0.06695843 | 0.60946131 |
22 | 4194304 | 2840018 | 267098 | 2572920 | 0.67711306 | 0.06368113 | 0.61343193 |
23 | 8388608 | 5685808 | 509398 | 5176410 | 0.67780113 | 0.06072497 | 0.61707616 |
24 | 16777216 | 11382395 | 972789 | 10409606 | 0.67844361 | 0.05798274 | 0.62046087 |