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-204x+971
f(0)=971
f(1)=3
f(2)=7
f(3)=23
f(4)=19
f(5)=1
f(6)=31
f(7)=17
f(8)=199
f(9)=1
f(10)=1
f(11)=1
f(12)=43
f(13)=1
f(14)=563
f(15)=233
f(16)=97
f(17)=1
f(18)=2377
f(19)=53
f(20)=1
f(21)=359
f(22)=337
f(23)=1
f(24)=197
f(25)=73
f(26)=1
f(27)=1
f(28)=1319
f(29)=1
f(30)=607
f(31)=61
f(32)=1511
f(33)=1
f(34)=229
f(35)=103
f(36)=5077
f(37)=1
f(38)=593
f(39)=683
f(40)=1
f(41)=1
f(42)=307
f(43)=1
f(44)=1
f(45)=773
f(46)=2099
f(47)=89
f(48)=1
f(49)=1
f(50)=2243
f(51)=1
f(52)=2311
f(53)=293
f(54)=7129
f(55)=1
f(56)=271
f(57)=463
f(58)=1
f(59)=79
f(60)=7669
f(61)=1
f(62)=373
f(63)=1
f(64)=2663
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=149
f(70)=2803
f(71)=353
f(72)=1
f(73)=179
f(74)=1
f(75)=1
f(76)=139
f(77)=367
f(78)=521
f(79)=1
f(80)=157
f(81)=281
f(82)=3011
f(83)=1
f(84)=9109
f(85)=127
f(86)=1
f(87)=1151
f(88)=3079
f(89)=193
f(90)=1327
f(91)=1
f(92)=1
f(93)=167
f(94)=347
f(95)=1
f(96)=9397
f(97)=1
f(98)=1
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-204x+971 could be written as f(y)= y^2-9433 with x=y+102
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-102
f'(x)>2x-205 with x > 97
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 | 1 | 7 | 1 | 0.125 | 0.875 |
4 | 16 | 12 | 1 | 11 | 0.75 | 0.0625 | 0.6875 |
5 | 32 | 22 | 2 | 20 | 0.6875 | 0.0625 | 0.625 |
6 | 64 | 41 | 5 | 36 | 0.640625 | 0.078125 | 0.5625 |
7 | 128 | 63 | 8 | 55 | 0.4921875 | 0.0625 | 0.4296875 |
8 | 256 | 80 | 9 | 71 | 0.3125 | 0.03515625 | 0.27734375 |
9 | 512 | 207 | 25 | 182 | 0.40429688 | 0.04882813 | 0.35546875 |
10 | 1024 | 490 | 49 | 441 | 0.47851563 | 0.04785156 | 0.43066406 |
11 | 2048 | 1091 | 95 | 996 | 0.53271484 | 0.04638672 | 0.48632813 |
12 | 4096 | 2301 | 169 | 2132 | 0.56176758 | 0.04125977 | 0.52050781 |
13 | 8192 | 4750 | 289 | 4461 | 0.57983398 | 0.03527832 | 0.54455566 |
14 | 16384 | 9727 | 554 | 9173 | 0.59368896 | 0.03381348 | 0.55987549 |
15 | 32768 | 19737 | 1011 | 18726 | 0.60232544 | 0.03085327 | 0.57147217 |
16 | 65536 | 39930 | 1847 | 38083 | 0.60928345 | 0.02818298 | 0.58110046 |
17 | 131072 | 80589 | 3431 | 77158 | 0.61484528 | 0.02617645 | 0.58866882 |
18 | 262144 | 162358 | 6464 | 155894 | 0.61934662 | 0.0246582 | 0.59468842 |
19 | 524288 | 327318 | 12118 | 315200 | 0.62430954 | 0.02311325 | 0.60119629 |
20 | 1048576 | 658626 | 22922 | 635704 | 0.6281147 | 0.02186012 | 0.60625458 |
21 | 2097152 | 1324308 | 43254 | 1281054 | 0.63147926 | 0.02062511 | 0.61085415 |
22 | 4194304 | 2661451 | 82366 | 2579085 | 0.63453937 | 0.01963758 | 0.61490178 |
23 | 8388608 | 5345078 | 156950 | 5188128 | 0.63718295 | 0.0187099 | 0.61847305 |
24 | 16777216 | 10731329 | 299813 | 10431516 | 0.63963705 | 0.01787025 | 0.62176681 |