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-72x+263
f(0)=263
f(1)=3
f(2)=41
f(3)=7
f(4)=1
f(5)=1
f(6)=19
f(7)=1
f(8)=83
f(9)=1
f(10)=17
f(11)=1
f(12)=457
f(13)=1
f(14)=61
f(15)=37
f(16)=211
f(17)=1
f(18)=709
f(19)=31
f(20)=1
f(21)=101
f(22)=1
f(23)=1
f(24)=127
f(25)=1
f(26)=311
f(27)=1
f(28)=1
f(29)=1
f(30)=997
f(31)=1
f(32)=113
f(33)=1
f(34)=1
f(35)=43
f(36)=1033
f(37)=1
f(38)=1
f(39)=1
f(40)=1
f(41)=1
f(42)=1
f(43)=1
f(44)=1
f(45)=1
f(46)=1
f(47)=1
f(48)=1
f(49)=1
f(50)=1
f(51)=1
f(52)=1
f(53)=1
f(54)=1
f(55)=1
f(56)=1
f(57)=1
f(58)=1
f(59)=1
f(60)=1
f(61)=1
f(62)=1
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=137
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)=163
f(87)=1
f(88)=557
f(89)=1
f(90)=269
f(91)=1
f(92)=701
f(93)=277
f(94)=1
f(95)=1
f(96)=151
f(97)=1
f(98)=937
f(99)=367
b) Substitution of the polynom
The polynom f(x)=x^2-72x+263 could be written as f(y)= y^2-1033 with x=y+36
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-36
f'(x)>2x-73 with x > 32
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 | 1 | 3 | 1 | 0.25 | 0.75 |
3 | 8 | 6 | 1 | 5 | 0.75 | 0.125 | 0.625 |
4 | 16 | 11 | 2 | 9 | 0.6875 | 0.125 | 0.5625 |
5 | 32 | 18 | 4 | 14 | 0.5625 | 0.125 | 0.4375 |
6 | 64 | 20 | 5 | 15 | 0.3125 | 0.078125 | 0.234375 |
7 | 128 | 45 | 7 | 38 | 0.3515625 | 0.0546875 | 0.296875 |
8 | 256 | 115 | 18 | 97 | 0.44921875 | 0.0703125 | 0.37890625 |
9 | 512 | 268 | 29 | 239 | 0.5234375 | 0.05664063 | 0.46679688 |
10 | 1024 | 570 | 50 | 520 | 0.55664063 | 0.04882813 | 0.5078125 |
11 | 2048 | 1180 | 88 | 1092 | 0.57617188 | 0.04296875 | 0.53320313 |
12 | 4096 | 2427 | 183 | 2244 | 0.5925293 | 0.04467773 | 0.54785156 |
13 | 8192 | 4954 | 328 | 4626 | 0.60473633 | 0.04003906 | 0.56469727 |
14 | 16384 | 10066 | 597 | 9469 | 0.61437988 | 0.03643799 | 0.57794189 |
15 | 32768 | 20346 | 1095 | 19251 | 0.62091064 | 0.03341675 | 0.5874939 |
16 | 65536 | 41101 | 1977 | 39124 | 0.62715149 | 0.03016663 | 0.59698486 |
17 | 131072 | 82734 | 3739 | 78995 | 0.63121033 | 0.02852631 | 0.60268402 |
18 | 262144 | 166463 | 7055 | 159408 | 0.63500595 | 0.02691269 | 0.60809326 |
19 | 524288 | 334648 | 13099 | 321549 | 0.63829041 | 0.02498436 | 0.61330605 |
20 | 1048576 | 672353 | 24927 | 647426 | 0.64120579 | 0.02377224 | 0.61743355 |
21 | 2097152 | 1349937 | 47444 | 1302493 | 0.64370012 | 0.02262306 | 0.62107706 |
22 | 4194304 | 2709715 | 90284 | 2619431 | 0.6460464 | 0.02152538 | 0.62452102 |
23 | 8388608 | 5437571 | 171610 | 5265961 | 0.64820898 | 0.02045751 | 0.62775147 |
24 | 16777216 | 10908162 | 327803 | 10580359 | 0.65017712 | 0.01953858 | 0.63063854 |