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+120x-449
f(0)=449
f(1)=41
f(2)=5
f(3)=1
f(4)=47
f(5)=11
f(6)=307
f(7)=1
f(8)=23
f(9)=89
f(10)=37
f(11)=31
f(12)=227
f(13)=1
f(14)=1427
f(15)=197
f(16)=157
f(17)=1
f(18)=1
f(19)=137
f(20)=2351
f(21)=1
f(22)=107
f(23)=71
f(24)=97
f(25)=397
f(26)=3347
f(27)=1
f(28)=739
f(29)=1
f(30)=4051
f(31)=1
f(32)=883
f(33)=1
f(34)=4787
f(35)=311
f(36)=5167
f(37)=67
f(38)=101
f(39)=719
f(40)=541
f(41)=769
f(42)=1
f(43)=1
f(44)=1
f(45)=109
f(46)=7187
f(47)=1
f(48)=1523
f(49)=1
f(50)=83
f(51)=1
f(52)=1699
f(53)=1
f(54)=389
f(55)=1
f(56)=409
f(57)=241
f(58)=79
f(59)=1
f(60)=941
f(61)=331
f(62)=1
f(63)=277
f(64)=1
f(65)=1447
f(66)=11827
f(67)=151
f(68)=2467
f(69)=787
f(70)=181
f(71)=149
f(72)=1
f(73)=1
f(74)=13907
f(75)=443
f(76)=14447
f(77)=1
f(78)=2999
f(79)=1
f(80)=15551
f(81)=1979
f(82)=293
f(83)=1
f(84)=1
f(85)=1061
f(86)=557
f(87)=439
f(88)=3571
f(89)=2269
f(90)=18451
f(91)=1
f(92)=103
f(93)=1
f(94)=1
f(95)=1
f(96)=20287
f(97)=1
f(98)=1
f(99)=1327
b) Substitution of the polynom
The polynom f(x)=x^2+120x-449 could be written as f(y)= y^2-4049 with x=y-60
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+60
f'(x)>2x+119
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 | 2 | 2 | 1 | 0.5 | 0.5 |
3 | 8 | 7 | 3 | 4 | 0.875 | 0.375 | 0.5 |
4 | 16 | 14 | 4 | 10 | 0.875 | 0.25 | 0.625 |
5 | 32 | 24 | 7 | 17 | 0.75 | 0.21875 | 0.53125 |
6 | 64 | 44 | 10 | 34 | 0.6875 | 0.15625 | 0.53125 |
7 | 128 | 88 | 20 | 68 | 0.6875 | 0.15625 | 0.53125 |
8 | 256 | 163 | 40 | 123 | 0.63671875 | 0.15625 | 0.48046875 |
9 | 512 | 325 | 67 | 258 | 0.63476563 | 0.13085938 | 0.50390625 |
10 | 1024 | 641 | 110 | 531 | 0.62597656 | 0.10742188 | 0.51855469 |
11 | 2048 | 1287 | 201 | 1086 | 0.62841797 | 0.09814453 | 0.53027344 |
12 | 4096 | 2596 | 372 | 2224 | 0.63378906 | 0.09082031 | 0.54296875 |
13 | 8192 | 5208 | 692 | 4516 | 0.63574219 | 0.08447266 | 0.55126953 |
14 | 16384 | 10494 | 1251 | 9243 | 0.64050293 | 0.07635498 | 0.56414795 |
15 | 32768 | 21081 | 2294 | 18787 | 0.64334106 | 0.07000732 | 0.57333374 |
16 | 65536 | 42401 | 4286 | 38115 | 0.64698792 | 0.06539917 | 0.58158875 |
17 | 131072 | 85089 | 7988 | 77101 | 0.64917755 | 0.0609436 | 0.58823395 |
18 | 262144 | 170820 | 14968 | 155852 | 0.65162659 | 0.05709839 | 0.5945282 |
19 | 524288 | 342710 | 28311 | 314399 | 0.65366745 | 0.05399895 | 0.5996685 |
20 | 1048576 | 687582 | 53374 | 634208 | 0.65572929 | 0.05090141 | 0.60482788 |
21 | 2097152 | 1379186 | 101172 | 1278014 | 0.65764713 | 0.04824257 | 0.60940456 |
22 | 4194304 | 2765820 | 192169 | 2573651 | 0.65942287 | 0.04581666 | 0.61360621 |
23 | 8388608 | 5544691 | 366193 | 5178498 | 0.66097867 | 0.04365361 | 0.61732507 |
24 | 16777216 | 11111554 | 700234 | 10411320 | 0.66230023 | 0.0417372 | 0.62056303 |