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+1423
f(0)=1423
f(1)=89
f(2)=1427
f(3)=179
f(4)=1439
f(5)=181
f(6)=1459
f(7)=23
f(8)=1487
f(9)=47
f(10)=1523
f(11)=193
f(12)=1567
f(13)=199
f(14)=1619
f(15)=103
f(16)=73
f(17)=107
f(18)=1747
f(19)=223
f(20)=1823
f(21)=233
f(22)=1907
f(23)=61
f(24)=1999
f(25)=1
f(26)=2099
f(27)=269
f(28)=2207
f(29)=283
f(30)=101
f(31)=149
f(32)=2447
f(33)=157
f(34)=2579
f(35)=331
f(36)=2719
f(37)=349
f(38)=1
f(39)=1
f(40)=3023
f(41)=97
f(42)=3187
f(43)=409
f(44)=3359
f(45)=431
f(46)=3539
f(47)=227
f(48)=3727
f(49)=239
f(50)=3923
f(51)=503
f(52)=4127
f(53)=1
f(54)=4339
f(55)=139
f(56)=1
f(57)=1
f(58)=4787
f(59)=613
f(60)=5023
f(61)=643
f(62)=229
f(63)=337
f(64)=5519
f(65)=353
f(66)=5779
f(67)=739
f(68)=6047
f(69)=773
f(70)=6323
f(71)=1
f(72)=6607
f(73)=211
f(74)=6899
f(75)=881
f(76)=313
f(77)=919
f(78)=7507
f(79)=479
f(80)=7823
f(81)=499
f(82)=8147
f(83)=1039
f(84)=1
f(85)=1
f(86)=8819
f(87)=281
f(88)=1
f(89)=1
f(90)=1
f(91)=1213
f(92)=9887
f(93)=1259
f(94)=10259
f(95)=653
f(96)=10639
f(97)=677
f(98)=11027
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+1423 could be written as f(y)= y^2+1423 with x=y+0
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+0
f'(x)>2x-1 with x > 38
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 | 17 | 8 | 9 | 1.0625 | 0.5 | 0.5625 |
5 | 32 | 32 | 15 | 17 | 1 | 0.46875 | 0.53125 |
6 | 64 | 59 | 28 | 31 | 0.921875 | 0.4375 | 0.484375 |
7 | 128 | 113 | 52 | 61 | 0.8828125 | 0.40625 | 0.4765625 |
8 | 256 | 213 | 89 | 124 | 0.83203125 | 0.34765625 | 0.484375 |
9 | 512 | 414 | 163 | 251 | 0.80859375 | 0.31835938 | 0.49023438 |
10 | 1024 | 814 | 287 | 527 | 0.79492188 | 0.28027344 | 0.51464844 |
11 | 2048 | 1585 | 528 | 1057 | 0.77392578 | 0.2578125 | 0.51611328 |
12 | 4096 | 3126 | 950 | 2176 | 0.76318359 | 0.23193359 | 0.53125 |
13 | 8192 | 6223 | 1698 | 4525 | 0.75964355 | 0.20727539 | 0.55236816 |
14 | 16384 | 12372 | 3125 | 9247 | 0.75512695 | 0.19073486 | 0.56439209 |
15 | 32768 | 24533 | 5804 | 18729 | 0.74868774 | 0.17712402 | 0.57156372 |
16 | 65536 | 48828 | 10751 | 38077 | 0.74505615 | 0.16404724 | 0.58100891 |
17 | 131072 | 97206 | 20128 | 77078 | 0.74162292 | 0.15356445 | 0.58805847 |
18 | 262144 | 193655 | 37564 | 156091 | 0.7387352 | 0.14329529 | 0.59543991 |
19 | 524288 | 385795 | 70907 | 314888 | 0.73584557 | 0.13524437 | 0.6006012 |
20 | 1048576 | 769134 | 134046 | 635088 | 0.73350334 | 0.12783623 | 0.60566711 |
21 | 2097152 | 1533551 | 254240 | 1279311 | 0.7312541 | 0.12123108 | 0.61002302 |
22 | 4194304 | 3058994 | 483491 | 2575503 | 0.729321 | 0.11527324 | 0.61404777 |
23 | 8388608 | 6103940 | 920612 | 5183328 | 0.72764635 | 0.1097455 | 0.61790085 |
24 | 16777216 | 12181387 | 1759207 | 10422180 | 0.72606725 | 0.10485691 | 0.62121034 |