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-200x+839
f(0)=839
f(1)=5
f(2)=443
f(3)=31
f(4)=11
f(5)=17
f(6)=13
f(7)=1
f(8)=41
f(9)=1
f(10)=1061
f(11)=1
f(12)=109
f(13)=199
f(14)=353
f(15)=1
f(16)=421
f(17)=71
f(18)=2437
f(19)=1
f(20)=251
f(21)=73
f(22)=181
f(23)=101
f(24)=677
f(25)=1
f(26)=67
f(27)=479
f(28)=97
f(29)=103
f(30)=4261
f(31)=1
f(32)=349
f(33)=1
f(34)=1
f(35)=617
f(36)=1013
f(37)=59
f(38)=409
f(39)=1
f(40)=83
f(41)=1
f(42)=1
f(43)=739
f(44)=241
f(45)=1
f(46)=1249
f(47)=397
f(48)=587
f(49)=1
f(50)=6661
f(51)=1
f(52)=6857
f(53)=79
f(54)=1409
f(55)=223
f(56)=1
f(57)=457
f(58)=569
f(59)=1
f(60)=7561
f(61)=191
f(62)=7717
f(63)=487
f(64)=1
f(65)=1
f(66)=1601
f(67)=1009
f(68)=1
f(69)=1
f(70)=751
f(71)=1
f(72)=8377
f(73)=1
f(74)=1697
f(75)=1
f(76)=1
f(77)=1
f(78)=8677
f(79)=1
f(80)=8761
f(81)=1
f(82)=8837
f(83)=1109
f(84)=137
f(85)=1117
f(86)=163
f(87)=281
f(88)=127
f(89)=113
f(90)=1
f(91)=227
f(92)=827
f(93)=1
f(94)=1
f(95)=571
f(96)=1
f(97)=1
f(98)=9157
f(99)=229
b) Substitution of the polynom
The polynom f(x)=x^2-200x+839 could be written as f(y)= y^2-9161 with x=y+100
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-100
f'(x)>2x-201 with x > 96
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 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 8 | 2 | 6 | 1 | 0.25 | 0.75 |
4 | 16 | 13 | 3 | 10 | 0.8125 | 0.1875 | 0.625 |
5 | 32 | 26 | 5 | 21 | 0.8125 | 0.15625 | 0.65625 |
6 | 64 | 47 | 9 | 38 | 0.734375 | 0.140625 | 0.59375 |
7 | 128 | 68 | 15 | 53 | 0.53125 | 0.1171875 | 0.4140625 |
8 | 256 | 89 | 22 | 67 | 0.34765625 | 0.0859375 | 0.26171875 |
9 | 512 | 234 | 47 | 187 | 0.45703125 | 0.09179688 | 0.36523438 |
10 | 1024 | 534 | 90 | 444 | 0.52148438 | 0.08789063 | 0.43359375 |
11 | 2048 | 1143 | 174 | 969 | 0.55810547 | 0.08496094 | 0.47314453 |
12 | 4096 | 2426 | 318 | 2108 | 0.59228516 | 0.07763672 | 0.51464844 |
13 | 8192 | 4983 | 575 | 4408 | 0.60827637 | 0.07019043 | 0.53808594 |
14 | 16384 | 10132 | 1067 | 9065 | 0.6184082 | 0.06512451 | 0.55328369 |
15 | 32768 | 20483 | 1979 | 18504 | 0.62509155 | 0.06039429 | 0.56469727 |
16 | 65536 | 41314 | 3681 | 37633 | 0.63040161 | 0.0561676 | 0.57423401 |
17 | 131072 | 83315 | 6878 | 76437 | 0.63564301 | 0.05247498 | 0.58316803 |
18 | 262144 | 167602 | 12996 | 154606 | 0.63935089 | 0.04957581 | 0.58977509 |
19 | 524288 | 336685 | 24499 | 312186 | 0.64217567 | 0.04672813 | 0.59544754 |
20 | 1048576 | 676070 | 46464 | 629606 | 0.6447506 | 0.04431152 | 0.60043907 |
21 | 2097152 | 1357453 | 88166 | 1269287 | 0.64728403 | 0.04204082 | 0.60524321 |
22 | 4194304 | 2724582 | 167719 | 2556863 | 0.64959097 | 0.03998733 | 0.60960364 |
23 | 8388608 | 5466434 | 319209 | 5147225 | 0.65164971 | 0.03805268 | 0.61359704 |