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-44x+1451
f(0)=1451
f(1)=11
f(2)=1367
f(3)=83
f(4)=1291
f(5)=157
f(6)=1223
f(7)=149
f(8)=1163
f(9)=71
f(10)=101
f(11)=17
f(12)=97
f(13)=131
f(14)=1031
f(15)=127
f(16)=59
f(17)=31
f(18)=983
f(19)=61
f(20)=971
f(21)=1
f(22)=967
f(23)=1
f(24)=1
f(25)=1
f(26)=1
f(27)=1
f(28)=1
f(29)=1
f(30)=1
f(31)=1
f(32)=1
f(33)=1
f(34)=1
f(35)=1
f(36)=1
f(37)=1
f(38)=1
f(39)=1
f(40)=1
f(41)=1
f(42)=1
f(43)=1
f(44)=1
f(45)=1
f(46)=1543
f(47)=199
f(48)=53
f(49)=1
f(50)=103
f(51)=113
f(52)=1867
f(53)=241
f(54)=181
f(55)=257
f(56)=193
f(57)=137
f(58)=73
f(59)=1
f(60)=2411
f(61)=311
f(62)=151
f(63)=331
f(64)=2731
f(65)=1
f(66)=2903
f(67)=1
f(68)=3083
f(69)=397
f(70)=3271
f(71)=421
f(72)=3467
f(73)=223
f(74)=3671
f(75)=1
f(76)=353
f(77)=499
f(78)=373
f(79)=1
f(80)=1
f(81)=139
f(82)=4567
f(83)=293
f(84)=283
f(85)=617
f(86)=1
f(87)=1
f(88)=5323
f(89)=1
f(90)=5591
f(91)=179
f(92)=5867
f(93)=751
f(94)=6151
f(95)=787
f(96)=379
f(97)=1
f(98)=613
f(99)=431
b) Substitution of the polynom
The polynom f(x)=x^2-44x+1451 could be written as f(y)= y^2+967 with x=y+22
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-22
f'(x)>2x-45 with x > 31
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 | 17 | 6 | 11 | 1.0625 | 0.375 | 0.6875 |
5 | 32 | 22 | 9 | 13 | 0.6875 | 0.28125 | 0.40625 |
6 | 64 | 39 | 13 | 26 | 0.609375 | 0.203125 | 0.40625 |
7 | 128 | 85 | 30 | 55 | 0.6640625 | 0.234375 | 0.4296875 |
8 | 256 | 168 | 55 | 113 | 0.65625 | 0.21484375 | 0.44140625 |
9 | 512 | 346 | 96 | 250 | 0.67578125 | 0.1875 | 0.48828125 |
10 | 1024 | 683 | 190 | 493 | 0.66699219 | 0.18554688 | 0.48144531 |
11 | 2048 | 1367 | 326 | 1041 | 0.66748047 | 0.15917969 | 0.50830078 |
12 | 4096 | 2746 | 607 | 2139 | 0.67041016 | 0.14819336 | 0.5222168 |
13 | 8192 | 5485 | 1132 | 4353 | 0.66955566 | 0.13818359 | 0.53137207 |
14 | 16384 | 11062 | 2076 | 8986 | 0.6751709 | 0.12670898 | 0.54846191 |
15 | 32768 | 22185 | 3788 | 18397 | 0.67703247 | 0.11560059 | 0.56143188 |
16 | 65536 | 44532 | 6984 | 37548 | 0.67950439 | 0.10656738 | 0.57293701 |
17 | 131072 | 89127 | 13128 | 75999 | 0.67998505 | 0.10015869 | 0.57982635 |
18 | 262144 | 178536 | 24794 | 153742 | 0.68106079 | 0.0945816 | 0.58647919 |
19 | 524288 | 357537 | 46700 | 310837 | 0.68194771 | 0.08907318 | 0.59287453 |
20 | 1048576 | 715789 | 88142 | 627647 | 0.68262959 | 0.08405876 | 0.59857082 |
21 | 2097152 | 1432787 | 167145 | 1265642 | 0.68320608 | 0.07970095 | 0.60350513 |
22 | 4194304 | 2867476 | 317768 | 2549708 | 0.68365955 | 0.0757618 | 0.60789776 |
23 | 8388608 | 5738409 | 606049 | 5132360 | 0.68407166 | 0.07224667 | 0.61182499 |
24 | 16777216 | 11483050 | 1158039 | 10325011 | 0.68444312 | 0.0690245 | 0.61541861 |