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-240x+2767
f(0)=2767
f(1)=79
f(2)=29
f(3)=257
f(4)=1823
f(5)=199
f(6)=47
f(7)=71
f(8)=911
f(9)=43
f(10)=467
f(11)=31
f(12)=1
f(13)=23
f(14)=397
f(15)=19
f(16)=1
f(17)=1
f(18)=1229
f(19)=179
f(20)=1
f(21)=229
f(22)=2029
f(23)=139
f(24)=2417
f(25)=163
f(26)=2797
f(27)=373
f(28)=3169
f(29)=419
f(30)=3533
f(31)=1
f(32)=3889
f(33)=127
f(34)=223
f(35)=1
f(36)=1
f(37)=593
f(38)=4909
f(39)=317
f(40)=5233
f(41)=337
f(42)=1
f(43)=1
f(44)=5857
f(45)=751
f(46)=131
f(47)=197
f(48)=6449
f(49)=103
f(50)=6733
f(51)=859
f(52)=1
f(53)=1
f(54)=383
f(55)=463
f(56)=7537
f(57)=479
f(58)=7789
f(59)=1
f(60)=277
f(61)=1019
f(62)=8269
f(63)=1
f(64)=293
f(65)=269
f(66)=379
f(67)=1103
f(68)=8929
f(69)=1129
f(70)=9133
f(71)=577
f(72)=491
f(73)=1
f(74)=307
f(75)=1201
f(76)=9697
f(77)=1223
f(78)=1
f(79)=311
f(80)=1
f(81)=1
f(82)=443
f(83)=1283
f(84)=10337
f(85)=1301
f(86)=10477
f(87)=659
f(88)=1
f(89)=1
f(90)=10733
f(91)=1
f(92)=571
f(93)=1
f(94)=10957
f(95)=1
f(96)=11057
f(97)=347
f(98)=11149
f(99)=1399
b) Substitution of the polynom
The polynom f(x)=x^2-240x+2767 could be written as f(y)= y^2-11633 with x=y+120
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-120
f'(x)>2x-241 with x > 108
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 | 9 | 3 | 6 | 1.125 | 0.375 | 0.75 |
4 | 16 | 15 | 5 | 10 | 0.9375 | 0.3125 | 0.625 |
5 | 32 | 28 | 12 | 16 | 0.875 | 0.375 | 0.5 |
6 | 64 | 52 | 20 | 32 | 0.8125 | 0.3125 | 0.5 |
7 | 128 | 97 | 34 | 63 | 0.7578125 | 0.265625 | 0.4921875 |
8 | 256 | 108 | 40 | 68 | 0.421875 | 0.15625 | 0.265625 |
9 | 512 | 286 | 105 | 181 | 0.55859375 | 0.20507813 | 0.35351563 |
10 | 1024 | 647 | 203 | 444 | 0.63183594 | 0.19824219 | 0.43359375 |
11 | 2048 | 1371 | 374 | 997 | 0.66943359 | 0.18261719 | 0.48681641 |
12 | 4096 | 2806 | 694 | 2112 | 0.68505859 | 0.16943359 | 0.515625 |
13 | 8192 | 5656 | 1290 | 4366 | 0.69042969 | 0.1574707 | 0.53295898 |
14 | 16384 | 11387 | 2418 | 8969 | 0.69500732 | 0.14758301 | 0.54742432 |
15 | 32768 | 22845 | 4415 | 18430 | 0.69717407 | 0.13473511 | 0.56243896 |
16 | 65536 | 45742 | 8206 | 37536 | 0.69796753 | 0.12521362 | 0.57275391 |
17 | 131072 | 91467 | 15369 | 76098 | 0.69783783 | 0.11725616 | 0.58058167 |
18 | 262144 | 183053 | 28765 | 154288 | 0.69829178 | 0.10972977 | 0.58856201 |
19 | 524288 | 366070 | 54338 | 311732 | 0.69822311 | 0.10364151 | 0.5945816 |
20 | 1048576 | 731818 | 102867 | 628951 | 0.69791603 | 0.09810162 | 0.59981441 |
21 | 2097152 | 1463544 | 194852 | 1268692 | 0.69787216 | 0.09291267 | 0.60495949 |
22 | 4194304 | 2926345 | 370474 | 2555871 | 0.69769502 | 0.08832788 | 0.60936713 |
23 | 8388608 | 5851325 | 705765 | 5145560 | 0.6975323 | 0.08413374 | 0.61339855 |
24 | 16777216 | 11698099 | 1349567 | 10348532 | 0.69726104 | 0.08044046 | 0.61682057 |