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+100x-2797
f(0)=2797
f(1)=337
f(2)=2593
f(3)=311
f(4)=2381
f(5)=71
f(6)=2161
f(7)=1
f(8)=1933
f(9)=227
f(10)=1697
f(11)=197
f(12)=1453
f(13)=83
f(14)=1201
f(15)=67
f(16)=941
f(17)=101
f(18)=673
f(19)=1
f(20)=397
f(21)=1
f(22)=113
f(23)=1
f(24)=179
f(25)=41
f(26)=479
f(27)=79
f(28)=787
f(29)=59
f(30)=1103
f(31)=1
f(32)=1427
f(33)=199
f(34)=1759
f(35)=241
f(36)=2099
f(37)=1
f(38)=2447
f(39)=1
f(40)=2803
f(41)=373
f(42)=3167
f(43)=419
f(44)=3539
f(45)=233
f(46)=3919
f(47)=257
f(48)=73
f(49)=563
f(50)=4703
f(51)=613
f(52)=5107
f(53)=1
f(54)=5519
f(55)=1
f(56)=5939
f(57)=769
f(58)=6367
f(59)=823
f(60)=6803
f(61)=439
f(62)=7247
f(63)=467
f(64)=7699
f(65)=991
f(66)=1
f(67)=1049
f(68)=8627
f(69)=277
f(70)=9103
f(71)=1
f(72)=9587
f(73)=1229
f(74)=10079
f(75)=1291
f(76)=149
f(77)=677
f(78)=11087
f(79)=709
f(80)=283
f(81)=1483
f(82)=181
f(83)=1549
f(84)=12659
f(85)=1
f(86)=1
f(87)=421
f(88)=1
f(89)=1753
f(90)=14303
f(91)=1823
f(92)=14867
f(93)=947
f(94)=15439
f(95)=983
f(96)=193
f(97)=2039
f(98)=16607
f(99)=2113
b) Substitution of the polynom
The polynom f(x)=x^2+100x-2797 could be written as f(y)= y^2-5297 with x=y-50
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+50
f'(x)>2x+99
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 | 16 | 9 | 7 | 1 | 0.5625 | 0.4375 |
5 | 32 | 28 | 17 | 11 | 0.875 | 0.53125 | 0.34375 |
6 | 64 | 56 | 32 | 24 | 0.875 | 0.5 | 0.375 |
7 | 128 | 107 | 51 | 56 | 0.8359375 | 0.3984375 | 0.4375 |
8 | 256 | 217 | 92 | 125 | 0.84765625 | 0.359375 | 0.48828125 |
9 | 512 | 427 | 160 | 267 | 0.83398438 | 0.3125 | 0.52148438 |
10 | 1024 | 829 | 291 | 538 | 0.80957031 | 0.28417969 | 0.52539063 |
11 | 2048 | 1616 | 535 | 1081 | 0.7890625 | 0.26123047 | 0.52783203 |
12 | 4096 | 3187 | 975 | 2212 | 0.77807617 | 0.23803711 | 0.54003906 |
13 | 8192 | 6302 | 1795 | 4507 | 0.76928711 | 0.21911621 | 0.5501709 |
14 | 16384 | 12462 | 3289 | 9173 | 0.76062012 | 0.20074463 | 0.55987549 |
15 | 32768 | 24764 | 6120 | 18644 | 0.7557373 | 0.18676758 | 0.56896973 |
16 | 65536 | 49197 | 11345 | 37852 | 0.75068665 | 0.17311096 | 0.57757568 |
17 | 131072 | 97906 | 21104 | 76802 | 0.7469635 | 0.16101074 | 0.58595276 |
18 | 262144 | 195004 | 39485 | 155519 | 0.74388123 | 0.15062332 | 0.5932579 |
19 | 524288 | 388256 | 74311 | 313945 | 0.74053955 | 0.14173698 | 0.59880257 |
20 | 1048576 | 773659 | 140669 | 632990 | 0.73781872 | 0.13415241 | 0.60366631 |
21 | 2097152 | 1542378 | 266540 | 1275838 | 0.73546314 | 0.12709618 | 0.60836697 |
22 | 4194304 | 3075719 | 506245 | 2569474 | 0.73330855 | 0.12069821 | 0.61261034 |
23 | 8388608 | 6135657 | 965407 | 5170250 | 0.73142731 | 0.11508548 | 0.61634183 |
24 | 16777216 | 12240971 | 1845277 | 10395694 | 0.72961873 | 0.10998708 | 0.61963165 |