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+29x-409
f(0)=409
f(1)=379
f(2)=347
f(3)=313
f(4)=277
f(5)=239
f(6)=199
f(7)=157
f(8)=113
f(9)=67
f(10)=19
f(11)=31
f(12)=83
f(13)=137
f(14)=193
f(15)=251
f(16)=311
f(17)=373
f(18)=23
f(19)=503
f(20)=571
f(21)=641
f(22)=1
f(23)=787
f(24)=863
f(25)=941
f(26)=1021
f(27)=1103
f(28)=1187
f(29)=1
f(30)=1361
f(31)=1451
f(32)=1543
f(33)=1637
f(34)=1733
f(35)=1831
f(36)=1931
f(37)=107
f(38)=2137
f(39)=2243
f(40)=2351
f(41)=1
f(42)=1
f(43)=2687
f(44)=2803
f(45)=127
f(46)=3041
f(47)=3163
f(48)=173
f(49)=3413
f(50)=3541
f(51)=3671
f(52)=3803
f(53)=1
f(54)=4073
f(55)=4211
f(56)=229
f(57)=4493
f(58)=4637
f(59)=4783
f(60)=4931
f(61)=5081
f(62)=5233
f(63)=5387
f(64)=241
f(65)=5701
f(66)=5861
f(67)=317
f(68)=269
f(69)=6353
f(70)=6521
f(71)=6691
f(72)=6863
f(73)=227
f(74)=7213
f(75)=389
f(76)=1
f(77)=7753
f(78)=7937
f(79)=8123
f(80)=8311
f(81)=8501
f(82)=8693
f(83)=8887
f(84)=293
f(85)=9281
f(86)=499
f(87)=421
f(88)=9887
f(89)=10093
f(90)=10301
f(91)=457
f(92)=10723
f(93)=10937
f(94)=587
f(95)=1
f(96)=1
f(97)=11813
f(98)=12037
f(99)=12263
b) Substitution of the polynom
The polynom f(x)=x^2+29x-409 could be written as f(y)= y^2-619.25 with x=y-14.5
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+14.5
f'(x)>2x+28
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 | 3 | 0 | 1.5 | 1.5 | 0 |
2 | 4 | 5 | 5 | 0 | 1.25 | 1.25 | 0 |
3 | 8 | 9 | 9 | 0 | 1.125 | 1.125 | 0 |
4 | 16 | 17 | 17 | 0 | 1.0625 | 1.0625 | 0 |
5 | 32 | 31 | 30 | 1 | 0.96875 | 0.9375 | 0.03125 |
6 | 64 | 60 | 54 | 6 | 0.9375 | 0.84375 | 0.09375 |
7 | 128 | 119 | 97 | 22 | 0.9296875 | 0.7578125 | 0.171875 |
8 | 256 | 233 | 175 | 58 | 0.91015625 | 0.68359375 | 0.2265625 |
9 | 512 | 455 | 313 | 142 | 0.88867188 | 0.61132813 | 0.27734375 |
10 | 1024 | 893 | 553 | 340 | 0.87207031 | 0.54003906 | 0.33203125 |
11 | 2048 | 1762 | 974 | 788 | 0.86035156 | 0.47558594 | 0.38476563 |
12 | 4096 | 3456 | 1784 | 1672 | 0.84375 | 0.43554688 | 0.40820313 |
13 | 8192 | 6850 | 3279 | 3571 | 0.83618164 | 0.40026855 | 0.43591309 |
14 | 16384 | 13545 | 5968 | 7577 | 0.82672119 | 0.36425781 | 0.46246338 |
15 | 32768 | 26807 | 10998 | 15809 | 0.81808472 | 0.33563232 | 0.48245239 |
16 | 65536 | 53037 | 20401 | 32636 | 0.8092804 | 0.31129456 | 0.49798584 |
17 | 131072 | 105105 | 38219 | 66886 | 0.80188751 | 0.29158783 | 0.51029968 |
18 | 262144 | 208487 | 71860 | 136627 | 0.79531479 | 0.27412415 | 0.52119064 |
19 | 524288 | 413989 | 135441 | 278548 | 0.78962135 | 0.25833321 | 0.53128815 |
20 | 1048576 | 822626 | 256354 | 566272 | 0.78451729 | 0.24447823 | 0.54003906 |
21 | 2097152 | 1635802 | 485249 | 1150553 | 0.78001118 | 0.23138475 | 0.54862642 |
22 | 4194304 | 3254522 | 922573 | 2331949 | 0.77593851 | 0.21995854 | 0.55597997 |
23 | 8388608 | 6477839 | 1759451 | 4718388 | 0.77221859 | 0.2097429 | 0.56247568 |
24 | 16777216 | 12897501 | 3360816 | 9536685 | 0.76875097 | 0.20032024 | 0.56843072 |