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+124x-829
f(0)=829
f(1)=11
f(2)=577
f(3)=7
f(4)=317
f(5)=23
f(6)=1
f(7)=1
f(8)=227
f(9)=1
f(10)=73
f(11)=41
f(12)=1
f(13)=17
f(14)=1103
f(15)=157
f(16)=83
f(17)=1
f(18)=1
f(19)=59
f(20)=293
f(21)=277
f(22)=2383
f(23)=29
f(24)=389
f(25)=181
f(26)=37
f(27)=1
f(28)=149
f(29)=1
f(30)=223
f(31)=71
f(32)=1
f(33)=1
f(34)=1
f(35)=1
f(36)=4931
f(37)=641
f(38)=761
f(39)=691
f(40)=521
f(41)=53
f(42)=6143
f(43)=397
f(44)=6563
f(45)=1
f(46)=6991
f(47)=1
f(48)=1061
f(49)=239
f(50)=463
f(51)=1
f(52)=1
f(53)=1069
f(54)=8783
f(55)=1
f(56)=1
f(57)=593
f(58)=137
f(59)=89
f(60)=10211
f(61)=1307
f(62)=139
f(63)=1
f(64)=659
f(65)=179
f(66)=1
f(67)=1
f(68)=12227
f(69)=1
f(70)=311
f(71)=1627
f(72)=359
f(73)=1
f(74)=601
f(75)=881
f(76)=2053
f(77)=1831
f(78)=1
f(79)=1901
f(80)=2213
f(81)=1
f(82)=16063
f(83)=1
f(84)=1
f(85)=1
f(86)=17231
f(87)=313
f(88)=17827
f(89)=103
f(90)=2633
f(91)=1171
f(92)=1
f(93)=1
f(94)=1
f(95)=1
f(96)=197
f(97)=1
f(98)=1231
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+124x-829 could be written as f(y)= y^2-4673 with x=y-62
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+62
f'(x)>2x+123
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 | 7 | 4 | 3 | 0.875 | 0.5 | 0.375 |
4 | 16 | 13 | 5 | 8 | 0.8125 | 0.3125 | 0.5 |
5 | 32 | 24 | 6 | 18 | 0.75 | 0.1875 | 0.5625 |
6 | 64 | 46 | 12 | 34 | 0.71875 | 0.1875 | 0.53125 |
7 | 128 | 88 | 19 | 69 | 0.6875 | 0.1484375 | 0.5390625 |
8 | 256 | 163 | 43 | 120 | 0.63671875 | 0.16796875 | 0.46875 |
9 | 512 | 325 | 70 | 255 | 0.63476563 | 0.13671875 | 0.49804688 |
10 | 1024 | 636 | 128 | 508 | 0.62109375 | 0.125 | 0.49609375 |
11 | 2048 | 1287 | 224 | 1063 | 0.62841797 | 0.109375 | 0.51904297 |
12 | 4096 | 2582 | 403 | 2179 | 0.63037109 | 0.09838867 | 0.53198242 |
13 | 8192 | 5197 | 722 | 4475 | 0.63439941 | 0.08813477 | 0.54626465 |
14 | 16384 | 10482 | 1355 | 9127 | 0.63977051 | 0.08270264 | 0.55706787 |
15 | 32768 | 21096 | 2523 | 18573 | 0.64379883 | 0.07699585 | 0.56680298 |
16 | 65536 | 42338 | 4674 | 37664 | 0.64602661 | 0.07131958 | 0.57470703 |
17 | 131072 | 85013 | 8812 | 76201 | 0.64859772 | 0.06723022 | 0.58136749 |
18 | 262144 | 170718 | 16427 | 154291 | 0.65123749 | 0.06266403 | 0.58857346 |
19 | 524288 | 342626 | 30883 | 311743 | 0.65350723 | 0.05890465 | 0.59460258 |
20 | 1048576 | 687225 | 58597 | 628628 | 0.65538883 | 0.05588245 | 0.59950638 |
21 | 2097152 | 1378745 | 110950 | 1267795 | 0.65743685 | 0.05290508 | 0.60453176 |
22 | 4194304 | 2764379 | 210996 | 2553383 | 0.65907931 | 0.05030537 | 0.60877395 |
23 | 8388608 | 5541651 | 402030 | 5139621 | 0.66061628 | 0.04792571 | 0.61269057 |
24 | 16777216 | 11107160 | 767989 | 10339171 | 0.66203833 | 0.04577571 | 0.61626261 |