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-92x+227
f(0)=227
f(1)=17
f(2)=47
f(3)=5
f(4)=1
f(5)=13
f(6)=1
f(7)=23
f(8)=89
f(9)=1
f(10)=593
f(11)=83
f(12)=733
f(13)=1
f(14)=173
f(15)=29
f(16)=43
f(17)=131
f(18)=1
f(19)=1
f(20)=1213
f(21)=79
f(22)=101
f(23)=1
f(24)=281
f(25)=181
f(26)=1489
f(27)=191
f(28)=313
f(29)=1
f(30)=71
f(31)=1
f(32)=1693
f(33)=1
f(34)=349
f(35)=1
f(36)=1789
f(37)=113
f(38)=73
f(39)=1
f(40)=109
f(41)=233
f(42)=1873
f(43)=1
f(44)=1
f(45)=59
f(46)=1889
f(47)=1
f(48)=1
f(49)=1
f(50)=1
f(51)=1
f(52)=1
f(53)=1
f(54)=1
f(55)=1
f(56)=1
f(57)=1
f(58)=1
f(59)=1
f(60)=1
f(61)=1
f(62)=1
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=1
f(75)=1
f(76)=1
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)=163
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-92x+227 could be written as f(y)= y^2-1889 with x=y+46
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-46
f'(x)>2x-93 with x > 43
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 | 4 | 2 | 2 | 1 | 0.5 | 0.5 |
3 | 8 | 7 | 2 | 5 | 0.875 | 0.25 | 0.625 |
4 | 16 | 13 | 4 | 9 | 0.8125 | 0.25 | 0.5625 |
5 | 32 | 24 | 7 | 17 | 0.75 | 0.21875 | 0.53125 |
6 | 64 | 33 | 10 | 23 | 0.515625 | 0.15625 | 0.359375 |
7 | 128 | 48 | 13 | 35 | 0.375 | 0.1015625 | 0.2734375 |
8 | 256 | 118 | 34 | 84 | 0.4609375 | 0.1328125 | 0.328125 |
9 | 512 | 270 | 61 | 209 | 0.52734375 | 0.11914063 | 0.40820313 |
10 | 1024 | 585 | 110 | 475 | 0.57128906 | 0.10742188 | 0.46386719 |
11 | 2048 | 1231 | 187 | 1044 | 0.60107422 | 0.09130859 | 0.50976563 |
12 | 4096 | 2531 | 371 | 2160 | 0.61791992 | 0.09057617 | 0.52734375 |
13 | 8192 | 5160 | 665 | 4495 | 0.62988281 | 0.08117676 | 0.54870605 |
14 | 16384 | 10445 | 1229 | 9216 | 0.63751221 | 0.07501221 | 0.5625 |
15 | 32768 | 21011 | 2231 | 18780 | 0.64120483 | 0.06808472 | 0.57312012 |
16 | 65536 | 42248 | 4220 | 38028 | 0.64465332 | 0.06439209 | 0.58026123 |
17 | 131072 | 84894 | 7876 | 77018 | 0.64768982 | 0.06008911 | 0.58760071 |
18 | 262144 | 170665 | 14798 | 155867 | 0.65103531 | 0.05644989 | 0.59458542 |
19 | 524288 | 342840 | 27673 | 315167 | 0.65391541 | 0.05278206 | 0.60113335 |
20 | 1048576 | 687722 | 52265 | 635457 | 0.65586281 | 0.04984379 | 0.60601902 |
21 | 2097152 | 1379257 | 99224 | 1280033 | 0.65768099 | 0.04731369 | 0.6103673 |
22 | 4194304 | 2765776 | 188228 | 2577548 | 0.65941238 | 0.04487705 | 0.61453533 |
23 | 8388608 | 5544300 | 359042 | 5185258 | 0.66093206 | 0.04280114 | 0.61813092 |
24 | 16777216 | 11110836 | 685752 | 10425084 | 0.66225743 | 0.040874 | 0.62138343 |