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+180x-277
f(0)=277
f(1)=3
f(2)=29
f(3)=17
f(4)=1
f(5)=1
f(6)=839
f(7)=43
f(8)=409
f(9)=89
f(10)=541
f(11)=19
f(12)=2027
f(13)=31
f(14)=271
f(15)=331
f(16)=953
f(17)=1
f(18)=173
f(19)=73
f(20)=1
f(21)=1
f(22)=463
f(23)=61
f(24)=149
f(25)=101
f(26)=1693
f(27)=83
f(28)=1
f(29)=241
f(30)=317
f(31)=1
f(32)=1
f(33)=211
f(34)=2333
f(35)=151
f(36)=7499
f(37)=1
f(38)=157
f(39)=1033
f(40)=947
f(41)=1
f(42)=109
f(43)=97
f(44)=103
f(45)=1231
f(46)=3373
f(47)=433
f(48)=10667
f(49)=1
f(50)=1
f(51)=719
f(52)=3929
f(53)=503
f(54)=727
f(55)=1
f(56)=227
f(57)=827
f(58)=167
f(59)=1
f(60)=487
f(61)=601
f(62)=4909
f(63)=1879
f(64)=5113
f(65)=163
f(66)=15959
f(67)=113
f(68)=1
f(69)=2113
f(70)=5741
f(71)=1
f(72)=1051
f(73)=379
f(74)=6173
f(75)=1
f(76)=2131
f(77)=1
f(78)=223
f(79)=1
f(80)=6841
f(81)=1
f(82)=7069
f(83)=449
f(84)=359
f(85)=1
f(86)=1
f(87)=1
f(88)=457
f(89)=1
f(90)=24023
f(91)=127
f(92)=1
f(93)=1
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=1
f(99)=1709
b) Substitution of the polynom
The polynom f(x)=x^2+180x-277 could be written as f(y)= y^2-8377 with x=y-90
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+90
f'(x)>2x+179
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 | 1 | 2 | 1.5 | 0.5 | 1 |
2 | 4 | 4 | 1 | 3 | 1 | 0.25 | 0.75 |
3 | 8 | 7 | 2 | 5 | 0.875 | 0.25 | 0.625 |
4 | 16 | 15 | 3 | 12 | 0.9375 | 0.1875 | 0.75 |
5 | 32 | 25 | 3 | 22 | 0.78125 | 0.09375 | 0.6875 |
6 | 64 | 51 | 5 | 46 | 0.796875 | 0.078125 | 0.71875 |
7 | 128 | 89 | 7 | 82 | 0.6953125 | 0.0546875 | 0.640625 |
8 | 256 | 166 | 16 | 150 | 0.6484375 | 0.0625 | 0.5859375 |
9 | 512 | 325 | 32 | 293 | 0.63476563 | 0.0625 | 0.57226563 |
10 | 1024 | 632 | 65 | 567 | 0.6171875 | 0.06347656 | 0.55371094 |
11 | 2048 | 1262 | 121 | 1141 | 0.61621094 | 0.05908203 | 0.55712891 |
12 | 4096 | 2541 | 215 | 2326 | 0.62036133 | 0.05249023 | 0.56787109 |
13 | 8192 | 5096 | 402 | 4694 | 0.62207031 | 0.04907227 | 0.57299805 |
14 | 16384 | 10263 | 729 | 9534 | 0.62640381 | 0.04449463 | 0.58190918 |
15 | 32768 | 20717 | 1340 | 19377 | 0.63223267 | 0.04089355 | 0.59133911 |
16 | 65536 | 41695 | 2502 | 39193 | 0.63621521 | 0.03817749 | 0.59803772 |
17 | 131072 | 83825 | 4684 | 79141 | 0.639534 | 0.03573608 | 0.60379791 |
18 | 262144 | 168447 | 8786 | 159661 | 0.64257431 | 0.03351593 | 0.60905838 |
19 | 524288 | 338220 | 16662 | 321558 | 0.64510345 | 0.03178024 | 0.61332321 |
20 | 1048576 | 679342 | 31464 | 647878 | 0.64787102 | 0.03000641 | 0.61786461 |
21 | 2097152 | 1362957 | 59592 | 1303365 | 0.64990854 | 0.02841568 | 0.62149286 |
22 | 4194304 | 2734286 | 113474 | 2620812 | 0.65190458 | 0.02705431 | 0.62485027 |
23 | 8388608 | 5484469 | 216199 | 5268270 | 0.65379965 | 0.02577293 | 0.62802672 |