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-152x+1559
f(0)=1559
f(1)=11
f(2)=1259
f(3)=139
f(4)=967
f(5)=103
f(6)=683
f(7)=17
f(8)=37
f(9)=1
f(10)=1
f(11)=1
f(12)=1
f(13)=31
f(14)=373
f(15)=1
f(16)=617
f(17)=23
f(18)=853
f(19)=1
f(20)=47
f(21)=149
f(22)=1301
f(23)=1
f(24)=89
f(25)=101
f(26)=1
f(27)=227
f(28)=1913
f(29)=251
f(30)=191
f(31)=137
f(32)=2281
f(33)=1
f(34)=223
f(35)=317
f(36)=2617
f(37)=337
f(38)=59
f(39)=1
f(40)=127
f(41)=1
f(42)=3061
f(43)=1
f(44)=1
f(45)=1
f(46)=107
f(47)=211
f(48)=3433
f(49)=109
f(50)=3541
f(51)=449
f(52)=331
f(53)=461
f(54)=3733
f(55)=1
f(56)=347
f(57)=241
f(58)=229
f(59)=491
f(60)=233
f(61)=499
f(62)=4021
f(63)=1
f(64)=4073
f(65)=1
f(66)=179
f(67)=1
f(68)=4153
f(69)=521
f(70)=113
f(71)=131
f(72)=4201
f(73)=263
f(74)=383
f(75)=1
f(76)=4217
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-152x+1559 could be written as f(y)= y^2-4217 with x=y+76
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-76
f'(x)>2x-153 with x > 65
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 | 12 | 6 | 6 | 0.75 | 0.375 | 0.375 |
5 | 32 | 25 | 10 | 15 | 0.78125 | 0.3125 | 0.46875 |
6 | 64 | 49 | 17 | 32 | 0.765625 | 0.265625 | 0.5 |
7 | 128 | 58 | 20 | 38 | 0.453125 | 0.15625 | 0.296875 |
8 | 256 | 123 | 46 | 77 | 0.48046875 | 0.1796875 | 0.30078125 |
9 | 512 | 286 | 87 | 199 | 0.55859375 | 0.16992188 | 0.38867188 |
10 | 1024 | 624 | 168 | 456 | 0.609375 | 0.1640625 | 0.4453125 |
11 | 2048 | 1294 | 306 | 988 | 0.63183594 | 0.14941406 | 0.48242188 |
12 | 4096 | 2658 | 554 | 2104 | 0.64892578 | 0.13525391 | 0.51367188 |
13 | 8192 | 5376 | 1039 | 4337 | 0.65625 | 0.12683105 | 0.52941895 |
14 | 16384 | 10902 | 1920 | 8982 | 0.66540527 | 0.1171875 | 0.54821777 |
15 | 32768 | 21879 | 3578 | 18301 | 0.66769409 | 0.10919189 | 0.5585022 |
16 | 65536 | 44026 | 6676 | 37350 | 0.67178345 | 0.10186768 | 0.56991577 |
17 | 131072 | 88366 | 12363 | 76003 | 0.67417908 | 0.0943222 | 0.57985687 |
18 | 262144 | 177183 | 23025 | 154158 | 0.67589951 | 0.0878334 | 0.5880661 |
19 | 524288 | 354879 | 43416 | 311463 | 0.67687798 | 0.08280945 | 0.59406853 |
20 | 1048576 | 710469 | 82474 | 627995 | 0.67755604 | 0.07865334 | 0.5989027 |
21 | 2097152 | 1422486 | 156444 | 1266042 | 0.67829418 | 0.07459831 | 0.60369587 |
22 | 4194304 | 2847617 | 297187 | 2550430 | 0.6789248 | 0.0708549 | 0.6080699 |
23 | 8388608 | 5701070 | 566357 | 5134713 | 0.6796205 | 0.06751502 | 0.61210549 |
24 | 16777216 | 11410338 | 1082298 | 10328040 | 0.68010914 | 0.06450999 | 0.61559916 |