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-227
f(0)=227
f(1)=113
f(2)=223
f(3)=109
f(4)=211
f(5)=101
f(6)=191
f(7)=89
f(8)=163
f(9)=73
f(10)=127
f(11)=53
f(12)=83
f(13)=29
f(14)=31
f(15)=1
f(16)=1
f(17)=1
f(18)=97
f(19)=67
f(20)=173
f(21)=107
f(22)=257
f(23)=151
f(24)=349
f(25)=199
f(26)=449
f(27)=251
f(28)=557
f(29)=307
f(30)=673
f(31)=367
f(32)=797
f(33)=431
f(34)=929
f(35)=499
f(36)=1069
f(37)=571
f(38)=1217
f(39)=647
f(40)=1373
f(41)=727
f(42)=1
f(43)=811
f(44)=1709
f(45)=1
f(46)=1889
f(47)=991
f(48)=1
f(49)=1087
f(50)=2273
f(51)=1187
f(52)=2477
f(53)=1291
f(54)=2689
f(55)=1399
f(56)=2909
f(57)=1511
f(58)=3137
f(59)=1627
f(60)=3373
f(61)=1747
f(62)=3617
f(63)=1871
f(64)=1
f(65)=1999
f(66)=4129
f(67)=2131
f(68)=4397
f(69)=2267
f(70)=4673
f(71)=1
f(72)=4957
f(73)=2551
f(74)=181
f(75)=2699
f(76)=179
f(77)=2851
f(78)=5857
f(79)=1
f(80)=6173
f(81)=3167
f(82)=1
f(83)=3331
f(84)=6829
f(85)=3499
f(86)=1
f(87)=3671
f(88)=7517
f(89)=3847
f(90)=7873
f(91)=4027
f(92)=8237
f(93)=4211
f(94)=8609
f(95)=1
f(96)=1
f(97)=4591
f(98)=9377
f(99)=4787
b) Substitution of the polynom
The polynom f(x)=x^2-227 could be written as f(y)= y^2-227 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 > 15
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 | 15 | 8 | 7 | 0.9375 | 0.5 | 0.4375 |
5 | 32 | 30 | 16 | 14 | 0.9375 | 0.5 | 0.4375 |
6 | 64 | 58 | 29 | 29 | 0.90625 | 0.453125 | 0.453125 |
7 | 128 | 108 | 50 | 58 | 0.84375 | 0.390625 | 0.453125 |
8 | 256 | 214 | 91 | 123 | 0.8359375 | 0.35546875 | 0.48046875 |
9 | 512 | 427 | 150 | 277 | 0.83398438 | 0.29296875 | 0.54101563 |
10 | 1024 | 853 | 275 | 578 | 0.83300781 | 0.26855469 | 0.56445313 |
11 | 2048 | 1674 | 494 | 1180 | 0.81738281 | 0.24121094 | 0.57617188 |
12 | 4096 | 3296 | 872 | 2424 | 0.8046875 | 0.21289063 | 0.59179688 |
13 | 8192 | 6526 | 1553 | 4973 | 0.79663086 | 0.1895752 | 0.60705566 |
14 | 16384 | 12912 | 2884 | 10028 | 0.78808594 | 0.17602539 | 0.61206055 |
15 | 32768 | 25602 | 5319 | 20283 | 0.78131104 | 0.162323 | 0.61898804 |
16 | 65536 | 50747 | 9945 | 40802 | 0.77433777 | 0.15174866 | 0.62258911 |
17 | 131072 | 100743 | 18618 | 82125 | 0.76860809 | 0.14204407 | 0.62656403 |
18 | 262144 | 200381 | 34716 | 165665 | 0.76439285 | 0.13243103 | 0.63196182 |
19 | 524288 | 398673 | 65520 | 333153 | 0.7604084 | 0.12496948 | 0.63543892 |
20 | 1048576 | 793365 | 124137 | 669228 | 0.75661182 | 0.11838627 | 0.63822556 |
21 | 2097152 | 1580519 | 234829 | 1345690 | 0.75365019 | 0.11197519 | 0.641675 |
22 | 4194304 | 3148761 | 446969 | 2701792 | 0.75072312 | 0.10656571 | 0.64415741 |
23 | 8388608 | 6276245 | 851542 | 5424703 | 0.74818671 | 0.10151172 | 0.64667499 |
24 | 16777216 | 12512309 | 1625480 | 10886829 | 0.74579173 | 0.09688616 | 0.64890558 |