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+563
f(0)=563
f(1)=3
f(2)=23
f(3)=1
f(4)=47
f(5)=13
f(6)=37
f(7)=1
f(8)=271
f(9)=61
f(10)=379
f(11)=1
f(12)=1453
f(13)=67
f(14)=587
f(15)=239
f(16)=229
f(17)=1
f(18)=181
f(19)=1
f(20)=293
f(21)=347
f(22)=971
f(23)=127
f(24)=3181
f(25)=1
f(26)=31
f(27)=223
f(28)=1231
f(29)=53
f(30)=1
f(31)=1
f(32)=107
f(33)=1
f(34)=163
f(35)=1
f(36)=4621
f(37)=197
f(38)=179
f(39)=617
f(40)=73
f(41)=1
f(42)=5233
f(43)=1
f(44)=139
f(45)=1
f(46)=1867
f(47)=79
f(48)=251
f(49)=1
f(50)=1979
f(51)=1
f(52)=677
f(53)=257
f(54)=1
f(55)=263
f(56)=709
f(57)=1
f(58)=167
f(59)=137
f(60)=6637
f(61)=1
f(62)=2251
f(63)=1
f(64)=2287
f(65)=1
f(66)=6961
f(67)=1
f(68)=2351
f(69)=887
f(70)=1
f(71)=1
f(72)=7213
f(73)=151
f(74)=809
f(75)=457
f(76)=2447
f(77)=307
f(78)=7393
f(79)=103
f(80)=1
f(81)=233
f(82)=1
f(83)=1
f(84)=577
f(85)=313
f(86)=109
f(87)=941
f(88)=1
f(89)=157
f(90)=7537
f(91)=1
f(92)=1
f(93)=1
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=1
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-180x+563 could be written as f(y)= y^2-7537 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-181 with x > 87
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 | 1 | 6 | 0.875 | 0.125 | 0.75 |
4 | 16 | 14 | 2 | 12 | 0.875 | 0.125 | 0.75 |
5 | 32 | 25 | 3 | 22 | 0.78125 | 0.09375 | 0.6875 |
6 | 64 | 46 | 6 | 40 | 0.71875 | 0.09375 | 0.625 |
7 | 128 | 64 | 10 | 54 | 0.5 | 0.078125 | 0.421875 |
8 | 256 | 96 | 13 | 83 | 0.375 | 0.05078125 | 0.32421875 |
9 | 512 | 239 | 34 | 205 | 0.46679688 | 0.06640625 | 0.40039063 |
10 | 1024 | 541 | 60 | 481 | 0.52832031 | 0.05859375 | 0.46972656 |
11 | 2048 | 1157 | 116 | 1041 | 0.56494141 | 0.05664063 | 0.50830078 |
12 | 4096 | 2428 | 221 | 2207 | 0.59277344 | 0.05395508 | 0.53881836 |
13 | 8192 | 4975 | 392 | 4583 | 0.6072998 | 0.04785156 | 0.55944824 |
14 | 16384 | 10141 | 730 | 9411 | 0.61895752 | 0.04455566 | 0.57440186 |
15 | 32768 | 20553 | 1372 | 19181 | 0.62722778 | 0.04187012 | 0.58535767 |
16 | 65536 | 41507 | 2524 | 38983 | 0.63334656 | 0.03851318 | 0.59483337 |
17 | 131072 | 83544 | 4661 | 78883 | 0.63739014 | 0.03556061 | 0.60182953 |
18 | 262144 | 168012 | 8698 | 159314 | 0.64091492 | 0.03318024 | 0.60773468 |
19 | 524288 | 337615 | 16267 | 321348 | 0.64394951 | 0.03102684 | 0.61292267 |
20 | 1048576 | 677769 | 30854 | 646915 | 0.64637089 | 0.02942467 | 0.61694622 |
21 | 2097152 | 1360329 | 58539 | 1301790 | 0.64865541 | 0.02791357 | 0.62074184 |
22 | 4194304 | 2729677 | 111164 | 2618513 | 0.65080571 | 0.02650356 | 0.62430215 |
23 | 8388608 | 5476426 | 211669 | 5264757 | 0.65284085 | 0.02523291 | 0.62760794 |
24 | 16777216 | 10982375 | 404765 | 10577610 | 0.65460056 | 0.02412587 | 0.63047469 |