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+823
f(0)=823
f(1)=103
f(2)=827
f(3)=13
f(4)=839
f(5)=53
f(6)=859
f(7)=109
f(8)=887
f(9)=113
f(10)=71
f(11)=59
f(12)=967
f(13)=31
f(14)=1019
f(15)=131
f(16)=83
f(17)=139
f(18)=37
f(19)=1
f(20)=1223
f(21)=79
f(22)=1307
f(23)=1
f(24)=1399
f(25)=181
f(26)=1499
f(27)=97
f(28)=1607
f(29)=1
f(30)=1723
f(31)=223
f(32)=1847
f(33)=239
f(34)=1979
f(35)=1
f(36)=163
f(37)=137
f(38)=2267
f(39)=293
f(40)=2423
f(41)=313
f(42)=199
f(43)=167
f(44)=89
f(45)=1
f(46)=2939
f(47)=379
f(48)=1
f(49)=1
f(50)=3323
f(51)=107
f(52)=3527
f(53)=227
f(54)=3739
f(55)=1
f(56)=1
f(57)=509
f(58)=1
f(59)=269
f(60)=4423
f(61)=1
f(62)=359
f(63)=599
f(64)=4919
f(65)=631
f(66)=5179
f(67)=1
f(68)=419
f(69)=349
f(70)=1
f(71)=733
f(72)=6007
f(73)=769
f(74)=6299
f(75)=1
f(76)=6599
f(77)=211
f(78)=6907
f(79)=883
f(80)=233
f(81)=1
f(82)=7547
f(83)=241
f(84)=7879
f(85)=503
f(86)=8219
f(87)=1049
f(88)=659
f(89)=1093
f(90)=8923
f(91)=569
f(92)=251
f(93)=1
f(94)=743
f(95)=1231
f(96)=10039
f(97)=1279
f(98)=10427
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+823 could be written as f(y)= y^2+823 with x=y+0
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+0
f'(x)>2x-1 with x > 29
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 | 5 | 4 | 1.125 | 0.625 | 0.5 |
4 | 16 | 17 | 7 | 10 | 1.0625 | 0.4375 | 0.625 |
5 | 32 | 30 | 14 | 16 | 0.9375 | 0.4375 | 0.5 |
6 | 64 | 54 | 23 | 31 | 0.84375 | 0.359375 | 0.484375 |
7 | 128 | 102 | 40 | 62 | 0.796875 | 0.3125 | 0.484375 |
8 | 256 | 191 | 72 | 119 | 0.74609375 | 0.28125 | 0.46484375 |
9 | 512 | 370 | 126 | 244 | 0.72265625 | 0.24609375 | 0.4765625 |
10 | 1024 | 720 | 220 | 500 | 0.703125 | 0.21484375 | 0.48828125 |
11 | 2048 | 1427 | 396 | 1031 | 0.69677734 | 0.19335938 | 0.50341797 |
12 | 4096 | 2851 | 701 | 2150 | 0.69604492 | 0.17114258 | 0.52490234 |
13 | 8192 | 5704 | 1287 | 4417 | 0.69628906 | 0.15710449 | 0.53918457 |
14 | 16384 | 11359 | 2386 | 8973 | 0.69329834 | 0.14562988 | 0.54766846 |
15 | 32768 | 22710 | 4397 | 18313 | 0.6930542 | 0.13418579 | 0.55886841 |
16 | 65536 | 45441 | 8161 | 37280 | 0.69337463 | 0.12452698 | 0.56884766 |
17 | 131072 | 90967 | 15171 | 75796 | 0.69402313 | 0.11574554 | 0.57827759 |
18 | 262144 | 181997 | 28311 | 153686 | 0.69426346 | 0.10799789 | 0.58626556 |
19 | 524288 | 364045 | 53145 | 310900 | 0.69436073 | 0.10136604 | 0.59299469 |
20 | 1048576 | 727940 | 100650 | 627290 | 0.69421768 | 0.09598732 | 0.59823036 |
21 | 2097152 | 1455989 | 190911 | 1265078 | 0.69426966 | 0.09103346 | 0.6032362 |
22 | 4194304 | 2911925 | 363219 | 2548706 | 0.69425702 | 0.08659816 | 0.60765886 |
23 | 8388608 | 5823506 | 692360 | 5131146 | 0.69421601 | 0.08253574 | 0.61168027 |
24 | 16777216 | 11646793 | 1321565 | 10325228 | 0.69420296 | 0.07877141 | 0.61543155 |