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+84x-853
f(0)=853
f(1)=3
f(2)=227
f(3)=37
f(4)=167
f(5)=17
f(6)=313
f(7)=1
f(8)=13
f(9)=1
f(10)=29
f(11)=1
f(12)=23
f(13)=1
f(14)=173
f(15)=79
f(16)=83
f(17)=1
f(18)=983
f(19)=1
f(20)=409
f(21)=1
f(22)=1
f(23)=67
f(24)=47
f(25)=1
f(26)=223
f(27)=1
f(28)=761
f(29)=101
f(30)=151
f(31)=113
f(32)=953
f(33)=1
f(34)=1
f(35)=1
f(36)=3467
f(37)=1
f(38)=97
f(39)=1
f(40)=1
f(41)=89
f(42)=193
f(43)=1
f(44)=59
f(45)=619
f(46)=1709
f(47)=1
f(48)=5483
f(49)=1
f(50)=1949
f(51)=1
f(52)=691
f(53)=1
f(54)=6599
f(55)=283
f(56)=137
f(57)=449
f(58)=107
f(59)=1
f(60)=599
f(61)=1
f(62)=911
f(63)=1051
f(64)=1
f(65)=1
f(66)=109
f(67)=1
f(68)=1
f(69)=1213
f(70)=1103
f(71)=1
f(72)=1
f(73)=1
f(74)=3613
f(75)=1
f(76)=3769
f(77)=1
f(78)=11783
f(79)=1
f(80)=1
f(81)=1
f(82)=4253
f(83)=271
f(84)=13259
f(85)=563
f(86)=353
f(87)=1753
f(88)=1
f(89)=1
f(90)=1
f(91)=157
f(92)=5113
f(93)=1951
f(94)=1
f(95)=673
f(96)=16427
f(97)=1
f(98)=1
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+84x-853 could be written as f(y)= y^2-2617 with x=y-42
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+42
f'(x)>2x+83
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 | 1 | 4 | 1.25 | 0.25 | 1 |
3 | 8 | 8 | 2 | 6 | 1 | 0.25 | 0.75 |
4 | 16 | 13 | 2 | 11 | 0.8125 | 0.125 | 0.6875 |
5 | 32 | 23 | 3 | 20 | 0.71875 | 0.09375 | 0.625 |
6 | 64 | 41 | 6 | 35 | 0.640625 | 0.09375 | 0.546875 |
7 | 128 | 77 | 11 | 66 | 0.6015625 | 0.0859375 | 0.515625 |
8 | 256 | 151 | 18 | 133 | 0.58984375 | 0.0703125 | 0.51953125 |
9 | 512 | 300 | 31 | 269 | 0.5859375 | 0.06054688 | 0.52539063 |
10 | 1024 | 604 | 58 | 546 | 0.58984375 | 0.05664063 | 0.53320313 |
11 | 2048 | 1229 | 107 | 1122 | 0.60009766 | 0.05224609 | 0.54785156 |
12 | 4096 | 2497 | 198 | 2299 | 0.60961914 | 0.04833984 | 0.5612793 |
13 | 8192 | 5051 | 363 | 4688 | 0.61657715 | 0.04431152 | 0.57226563 |
14 | 16384 | 10183 | 676 | 9507 | 0.621521 | 0.04125977 | 0.58026123 |
15 | 32768 | 20543 | 1268 | 19275 | 0.62692261 | 0.03869629 | 0.58822632 |
16 | 65536 | 41311 | 2335 | 38976 | 0.63035583 | 0.03562927 | 0.59472656 |
17 | 131072 | 83074 | 4336 | 78738 | 0.63380432 | 0.03308105 | 0.60072327 |
18 | 262144 | 167117 | 8093 | 159024 | 0.63750076 | 0.03087234 | 0.60662842 |
19 | 524288 | 335771 | 15255 | 320516 | 0.64043236 | 0.0290966 | 0.61133575 |
20 | 1048576 | 674829 | 28818 | 646011 | 0.64356709 | 0.02748299 | 0.6160841 |
21 | 2097152 | 1354907 | 54581 | 1300326 | 0.64607 | 0.02602625 | 0.62004375 |
22 | 4194304 | 2719017 | 103996 | 2615021 | 0.64826417 | 0.02479458 | 0.62346959 |
23 | 8388608 | 5455660 | 198234 | 5257426 | 0.65036535 | 0.02363133 | 0.62673402 |
24 | 16777216 | 10942051 | 377870 | 10564181 | 0.65219706 | 0.02252281 | 0.62967426 |