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+188x-997
f(0)=997
f(1)=101
f(2)=617
f(3)=53
f(4)=229
f(5)=1
f(6)=167
f(7)=23
f(8)=571
f(9)=97
f(10)=983
f(11)=149
f(12)=61
f(13)=1
f(14)=1831
f(15)=1
f(16)=2267
f(17)=311
f(18)=2711
f(19)=367
f(20)=3163
f(21)=1
f(22)=3623
f(23)=241
f(24)=4091
f(25)=541
f(26)=4567
f(27)=601
f(28)=5051
f(29)=331
f(30)=1
f(31)=181
f(32)=6043
f(33)=787
f(34)=6551
f(35)=37
f(36)=191
f(37)=1
f(38)=7591
f(39)=491
f(40)=8123
f(41)=1049
f(42)=8663
f(43)=1117
f(44)=151
f(45)=593
f(46)=9767
f(47)=157
f(48)=10331
f(49)=1327
f(50)=10903
f(51)=1399
f(52)=11483
f(53)=1
f(54)=12071
f(55)=773
f(56)=239
f(57)=1621
f(58)=577
f(59)=1697
f(60)=13883
f(61)=887
f(62)=14503
f(63)=463
f(64)=15131
f(65)=1931
f(66)=15767
f(67)=2011
f(68)=16411
f(69)=523
f(70)=113
f(71)=1087
f(72)=479
f(73)=1
f(74)=347
f(75)=2341
f(76)=829
f(77)=1213
f(78)=19751
f(79)=1
f(80)=20443
f(81)=1
f(82)=21143
f(83)=2687
f(84)=21851
f(85)=1
f(86)=22567
f(87)=1433
f(88)=23291
f(89)=2957
f(90)=24023
f(91)=3049
f(92)=24763
f(93)=1571
f(94)=263
f(95)=809
f(96)=26267
f(97)=3331
f(98)=27031
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+188x-997 could be written as f(y)= y^2-9833 with x=y-94
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+94
f'(x)>2x+187
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 | 8 | 5 | 3 | 1 | 0.625 | 0.375 |
4 | 16 | 14 | 8 | 6 | 0.875 | 0.5 | 0.375 |
5 | 32 | 28 | 15 | 13 | 0.875 | 0.46875 | 0.40625 |
6 | 64 | 58 | 27 | 31 | 0.90625 | 0.421875 | 0.484375 |
7 | 128 | 112 | 48 | 64 | 0.875 | 0.375 | 0.5 |
8 | 256 | 222 | 86 | 136 | 0.8671875 | 0.3359375 | 0.53125 |
9 | 512 | 432 | 153 | 279 | 0.84375 | 0.29882813 | 0.54492188 |
10 | 1024 | 835 | 277 | 558 | 0.81542969 | 0.27050781 | 0.54492188 |
11 | 2048 | 1641 | 499 | 1142 | 0.80126953 | 0.24365234 | 0.55761719 |
12 | 4096 | 3203 | 932 | 2271 | 0.78198242 | 0.22753906 | 0.55444336 |
13 | 8192 | 6320 | 1704 | 4616 | 0.77148438 | 0.20800781 | 0.56347656 |
14 | 16384 | 12519 | 3102 | 9417 | 0.76409912 | 0.18933105 | 0.57476807 |
15 | 32768 | 24815 | 5835 | 18980 | 0.7572937 | 0.17807007 | 0.57922363 |
16 | 65536 | 49220 | 10854 | 38366 | 0.7510376 | 0.1656189 | 0.5854187 |
17 | 131072 | 97865 | 20331 | 77534 | 0.7466507 | 0.15511322 | 0.59153748 |
18 | 262144 | 194844 | 38148 | 156696 | 0.74327087 | 0.14552307 | 0.5977478 |
19 | 524288 | 388059 | 72049 | 316010 | 0.7401638 | 0.13742256 | 0.60274124 |
20 | 1048576 | 773256 | 136296 | 636960 | 0.73743439 | 0.12998199 | 0.60745239 |
21 | 2097152 | 1541037 | 258101 | 1282936 | 0.7348237 | 0.12307215 | 0.61175156 |
22 | 4194304 | 3073304 | 491121 | 2582183 | 0.73273277 | 0.11709237 | 0.6156404 |
23 | 8388608 | 6131246 | 935466 | 5195780 | 0.73090148 | 0.11151624 | 0.61938524 |
24 | 16777216 | 12233195 | 1786864 | 10446331 | 0.72915524 | 0.10650539 | 0.62264985 |