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+44x-733
f(0)=733
f(1)=43
f(2)=641
f(3)=37
f(4)=541
f(5)=61
f(6)=433
f(7)=47
f(8)=317
f(9)=1
f(10)=193
f(11)=1
f(12)=1
f(13)=1
f(14)=79
f(15)=19
f(16)=227
f(17)=1
f(18)=383
f(19)=29
f(20)=547
f(21)=1
f(22)=719
f(23)=101
f(24)=31
f(25)=1
f(26)=1087
f(27)=1
f(28)=1283
f(29)=173
f(30)=1487
f(31)=199
f(32)=1699
f(33)=113
f(34)=1
f(35)=127
f(36)=1
f(37)=283
f(38)=2383
f(39)=313
f(40)=71
f(41)=1
f(42)=2879
f(43)=1
f(44)=73
f(45)=409
f(46)=3407
f(47)=443
f(48)=1
f(49)=239
f(50)=3967
f(51)=257
f(52)=4259
f(53)=1
f(54)=97
f(55)=1
f(56)=157
f(57)=1
f(58)=1
f(59)=167
f(60)=5507
f(61)=709
f(62)=5839
f(63)=751
f(64)=1
f(65)=397
f(66)=107
f(67)=419
f(68)=6883
f(69)=883
f(70)=7247
f(71)=929
f(72)=401
f(73)=1
f(74)=421
f(75)=1
f(76)=8387
f(77)=1
f(78)=8783
f(79)=1123
f(80)=9187
f(81)=587
f(82)=331
f(83)=613
f(84)=233
f(85)=1279
f(86)=337
f(87)=1
f(88)=10883
f(89)=347
f(90)=241
f(91)=1
f(92)=11779
f(93)=1
f(94)=12239
f(95)=1559
f(96)=131
f(97)=809
f(98)=13183
f(99)=839
b) Substitution of the polynom
The polynom f(x)=x^2+44x-733 could be written as f(y)= y^2-1217 with x=y-22
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+22
f'(x)>2x+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 | 5 | 3 | 2 | 1.25 | 0.75 | 0.5 |
3 | 8 | 9 | 5 | 4 | 1.125 | 0.625 | 0.5 |
4 | 16 | 13 | 8 | 5 | 0.8125 | 0.5 | 0.3125 |
5 | 32 | 25 | 15 | 10 | 0.78125 | 0.46875 | 0.3125 |
6 | 64 | 47 | 22 | 25 | 0.734375 | 0.34375 | 0.390625 |
7 | 128 | 97 | 36 | 61 | 0.7578125 | 0.28125 | 0.4765625 |
8 | 256 | 185 | 66 | 119 | 0.72265625 | 0.2578125 | 0.46484375 |
9 | 512 | 357 | 122 | 235 | 0.69726563 | 0.23828125 | 0.45898438 |
10 | 1024 | 701 | 210 | 491 | 0.68457031 | 0.20507813 | 0.47949219 |
11 | 2048 | 1414 | 353 | 1061 | 0.69042969 | 0.17236328 | 0.51806641 |
12 | 4096 | 2825 | 669 | 2156 | 0.68969727 | 0.16333008 | 0.52636719 |
13 | 8192 | 5614 | 1239 | 4375 | 0.68530273 | 0.15124512 | 0.53405762 |
14 | 16384 | 11246 | 2307 | 8939 | 0.68640137 | 0.14080811 | 0.54559326 |
15 | 32768 | 22541 | 4247 | 18294 | 0.68789673 | 0.12960815 | 0.55828857 |
16 | 65536 | 45110 | 7800 | 37310 | 0.68832397 | 0.11901855 | 0.56930542 |
17 | 131072 | 90304 | 14631 | 75673 | 0.68896484 | 0.11162567 | 0.57733917 |
18 | 262144 | 180754 | 27332 | 153422 | 0.68952179 | 0.10426331 | 0.58525848 |
19 | 524288 | 361626 | 51455 | 310171 | 0.68974686 | 0.09814262 | 0.59160423 |
20 | 1048576 | 723620 | 97278 | 626342 | 0.69009781 | 0.09277153 | 0.59732628 |
21 | 2097152 | 1447338 | 184636 | 1262702 | 0.69014454 | 0.08804131 | 0.60210323 |
22 | 4194304 | 2894776 | 350984 | 2543792 | 0.69016838 | 0.08368111 | 0.60648727 |
23 | 8388608 | 5790194 | 668974 | 5121220 | 0.69024491 | 0.07974792 | 0.610497 |
24 | 16777216 | 11581921 | 1278172 | 10303749 | 0.69033629 | 0.07618499 | 0.6141513 |