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+52x-373
f(0)=373
f(1)=5
f(2)=53
f(3)=13
f(4)=149
f(5)=11
f(6)=1
f(7)=1
f(8)=107
f(9)=1
f(10)=19
f(11)=1
f(12)=79
f(13)=59
f(14)=29
f(15)=1
f(16)=1
f(17)=1
f(18)=887
f(19)=61
f(20)=97
f(21)=1
f(22)=251
f(23)=1
f(24)=1451
f(25)=1
f(26)=331
f(27)=1
f(28)=1867
f(29)=1
f(30)=2087
f(31)=1
f(32)=463
f(33)=1
f(34)=2551
f(35)=167
f(36)=43
f(37)=73
f(38)=277
f(39)=397
f(40)=3307
f(41)=1
f(42)=1
f(43)=1
f(44)=3851
f(45)=499
f(46)=827
f(47)=1
f(48)=233
f(49)=1
f(50)=163
f(51)=1
f(52)=1
f(53)=1
f(54)=5351
f(55)=1
f(56)=227
f(57)=1
f(58)=6007
f(59)=193
f(60)=577
f(61)=1
f(62)=103
f(63)=859
f(64)=641
f(65)=113
f(66)=1483
f(67)=1
f(68)=599
f(69)=997
f(70)=8167
f(71)=1
f(72)=1
f(73)=547
f(74)=8951
f(75)=1
f(76)=1871
f(77)=239
f(78)=9767
f(79)=1
f(80)=1
f(81)=1
f(82)=1
f(83)=677
f(84)=257
f(85)=1409
f(86)=1
f(87)=293
f(88)=919
f(89)=761
f(90)=653
f(91)=1
f(92)=1
f(93)=1
f(94)=1
f(95)=1699
f(96)=2767
f(97)=1
f(98)=14327
f(99)=911
b) Substitution of the polynom
The polynom f(x)=x^2+52x-373 could be written as f(y)= y^2-1049 with x=y-26
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+26
f'(x)>2x+51
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 | 5 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 7 | 3 | 4 | 0.875 | 0.375 | 0.5 |
4 | 16 | 11 | 3 | 8 | 0.6875 | 0.1875 | 0.5 |
5 | 32 | 20 | 7 | 13 | 0.625 | 0.21875 | 0.40625 |
6 | 64 | 40 | 12 | 28 | 0.625 | 0.1875 | 0.4375 |
7 | 128 | 76 | 18 | 58 | 0.59375 | 0.140625 | 0.453125 |
8 | 256 | 153 | 33 | 120 | 0.59765625 | 0.12890625 | 0.46875 |
9 | 512 | 309 | 59 | 250 | 0.60351563 | 0.11523438 | 0.48828125 |
10 | 1024 | 635 | 100 | 535 | 0.62011719 | 0.09765625 | 0.52246094 |
11 | 2048 | 1273 | 191 | 1082 | 0.62158203 | 0.09326172 | 0.52832031 |
12 | 4096 | 2561 | 348 | 2213 | 0.62524414 | 0.08496094 | 0.5402832 |
13 | 8192 | 5171 | 624 | 4547 | 0.63122559 | 0.07617188 | 0.55505371 |
14 | 16384 | 10413 | 1147 | 9266 | 0.63555908 | 0.07000732 | 0.56555176 |
15 | 32768 | 20998 | 2115 | 18883 | 0.64080811 | 0.06454468 | 0.57626343 |
16 | 65536 | 42244 | 3938 | 38306 | 0.64459229 | 0.06008911 | 0.58450317 |
17 | 131072 | 84821 | 7393 | 77428 | 0.64713287 | 0.05640411 | 0.59072876 |
18 | 262144 | 170413 | 13863 | 156550 | 0.65007401 | 0.05288315 | 0.59719086 |
19 | 524288 | 342131 | 25926 | 316205 | 0.6525631 | 0.04944992 | 0.60311317 |
20 | 1048576 | 686309 | 49008 | 637301 | 0.65451527 | 0.04673767 | 0.6077776 |
21 | 2097152 | 1376637 | 93112 | 1283525 | 0.65643167 | 0.04439926 | 0.61203241 |
22 | 4194304 | 2760644 | 176806 | 2583838 | 0.65818882 | 0.04215384 | 0.61603498 |
23 | 8388608 | 5534439 | 337606 | 5196833 | 0.65975654 | 0.04024577 | 0.61951077 |
24 | 16777216 | 11093436 | 644366 | 10449070 | 0.66122031 | 0.03840721 | 0.62281311 |