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-148x+467
f(0)=467
f(1)=5
f(2)=7
f(3)=1
f(4)=109
f(5)=31
f(6)=11
f(7)=13
f(8)=653
f(9)=1
f(10)=83
f(11)=1
f(12)=233
f(13)=23
f(14)=1409
f(15)=191
f(16)=47
f(17)=1
f(18)=1873
f(19)=1
f(20)=1
f(21)=1
f(22)=461
f(23)=43
f(24)=193
f(25)=163
f(26)=541
f(27)=1
f(28)=263
f(29)=373
f(30)=439
f(31)=79
f(32)=59
f(33)=1
f(34)=487
f(35)=1
f(36)=1
f(37)=1
f(38)=1
f(39)=1
f(40)=3853
f(41)=1
f(42)=797
f(43)=1
f(44)=587
f(45)=521
f(46)=1
f(47)=107
f(48)=619
f(49)=137
f(50)=1
f(51)=1
f(52)=181
f(53)=571
f(54)=419
f(55)=1
f(56)=937
f(57)=1
f(58)=97
f(59)=1
f(60)=4813
f(61)=1
f(62)=139
f(63)=1
f(64)=4909
f(65)=1
f(66)=1
f(67)=1
f(68)=4973
f(69)=89
f(70)=4993
f(71)=1
f(72)=1
f(73)=313
f(74)=5009
f(75)=1
f(76)=1
f(77)=1
f(78)=1
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-148x+467 could be written as f(y)= y^2-5009 with x=y+74
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-74
f'(x)>2x-149 with x > 71
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 | 4 | 2 | 2 | 1 | 0.5 | 0.5 |
3 | 8 | 8 | 3 | 5 | 1 | 0.375 | 0.625 |
4 | 16 | 14 | 4 | 10 | 0.875 | 0.25 | 0.625 |
5 | 32 | 25 | 5 | 20 | 0.78125 | 0.15625 | 0.625 |
6 | 64 | 41 | 8 | 33 | 0.640625 | 0.125 | 0.515625 |
7 | 128 | 46 | 11 | 35 | 0.359375 | 0.0859375 | 0.2734375 |
8 | 256 | 93 | 19 | 74 | 0.36328125 | 0.07421875 | 0.2890625 |
9 | 512 | 236 | 43 | 193 | 0.4609375 | 0.08398438 | 0.37695313 |
10 | 1024 | 520 | 80 | 440 | 0.5078125 | 0.078125 | 0.4296875 |
11 | 2048 | 1139 | 135 | 1004 | 0.55615234 | 0.06591797 | 0.49023438 |
12 | 4096 | 2372 | 248 | 2124 | 0.57910156 | 0.06054688 | 0.51855469 |
13 | 8192 | 4871 | 468 | 4403 | 0.59460449 | 0.05712891 | 0.53747559 |
14 | 16384 | 9882 | 840 | 9042 | 0.60314941 | 0.05126953 | 0.55187988 |
15 | 32768 | 19987 | 1609 | 18378 | 0.60995483 | 0.04910278 | 0.56085205 |
16 | 65536 | 40490 | 3004 | 37486 | 0.61782837 | 0.0458374 | 0.57199097 |
17 | 131072 | 81702 | 5588 | 76114 | 0.62333679 | 0.04263306 | 0.58070374 |
18 | 262144 | 164680 | 10388 | 154292 | 0.62820435 | 0.03962708 | 0.58857727 |
19 | 524288 | 331450 | 19531 | 311919 | 0.6321907 | 0.03725243 | 0.59493828 |
20 | 1048576 | 666345 | 36924 | 629421 | 0.63547611 | 0.03521347 | 0.60026264 |
21 | 2097152 | 1338384 | 70135 | 1268249 | 0.63819122 | 0.03344297 | 0.60474825 |
22 | 4194304 | 2688544 | 132996 | 2555548 | 0.64099884 | 0.03170872 | 0.60929012 |
23 | 8388608 | 5396653 | 253489 | 5143164 | 0.64333117 | 0.03021824 | 0.61311293 |
24 | 16777216 | 10829131 | 485752 | 10343379 | 0.64546651 | 0.02895308 | 0.61651343 |