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-104x+311
f(0)=311
f(1)=13
f(2)=107
f(3)=1
f(4)=89
f(5)=23
f(6)=277
f(7)=1
f(8)=457
f(9)=17
f(10)=37
f(11)=1
f(12)=61
f(13)=109
f(14)=73
f(15)=1
f(16)=1097
f(17)=1
f(18)=1237
f(19)=163
f(20)=1
f(21)=179
f(22)=1493
f(23)=97
f(24)=1609
f(25)=1
f(26)=101
f(27)=1
f(28)=79
f(29)=233
f(30)=83
f(31)=1
f(32)=1993
f(33)=127
f(34)=2069
f(35)=263
f(36)=2137
f(37)=271
f(38)=1
f(39)=139
f(40)=173
f(41)=71
f(42)=2293
f(43)=1
f(44)=137
f(45)=293
f(46)=2357
f(47)=1
f(48)=2377
f(49)=149
f(50)=2389
f(51)=1
f(52)=2393
f(53)=1
f(54)=1
f(55)=1
f(56)=1
f(57)=1
f(58)=1
f(59)=1
f(60)=1
f(61)=1
f(62)=1
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=1
f(75)=1
f(76)=1
f(77)=1
f(78)=1
f(79)=1
f(80)=1
f(81)=1
f(82)=1
f(83)=1
f(84)=1
f(85)=1
f(86)=1
f(87)=1
f(88)=1
f(89)=1
f(90)=1
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-104x+311 could be written as f(y)= y^2-2393 with x=y+52
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-52
f'(x)>2x-105 with x > 49
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 | 4 | 3 | 1 | 1 | 0.75 | 0.25 |
3 | 8 | 7 | 5 | 2 | 0.875 | 0.625 | 0.25 |
4 | 16 | 13 | 6 | 7 | 0.8125 | 0.375 | 0.4375 |
5 | 32 | 24 | 10 | 14 | 0.75 | 0.3125 | 0.4375 |
6 | 64 | 40 | 17 | 23 | 0.625 | 0.265625 | 0.359375 |
7 | 128 | 53 | 23 | 30 | 0.4140625 | 0.1796875 | 0.234375 |
8 | 256 | 138 | 51 | 87 | 0.5390625 | 0.19921875 | 0.33984375 |
9 | 512 | 304 | 100 | 204 | 0.59375 | 0.1953125 | 0.3984375 |
10 | 1024 | 645 | 187 | 458 | 0.62988281 | 0.18261719 | 0.44726563 |
11 | 2048 | 1332 | 335 | 997 | 0.65039063 | 0.16357422 | 0.48681641 |
12 | 4096 | 2709 | 607 | 2102 | 0.66137695 | 0.14819336 | 0.51318359 |
13 | 8192 | 5484 | 1100 | 4384 | 0.66943359 | 0.13427734 | 0.53515625 |
14 | 16384 | 11003 | 2045 | 8958 | 0.67156982 | 0.12481689 | 0.54675293 |
15 | 32768 | 22155 | 3866 | 18289 | 0.67611694 | 0.11798096 | 0.55813599 |
16 | 65536 | 44474 | 7131 | 37343 | 0.67861938 | 0.10881042 | 0.56980896 |
17 | 131072 | 89132 | 13310 | 75822 | 0.68002319 | 0.10154724 | 0.57847595 |
18 | 262144 | 178524 | 24847 | 153677 | 0.68101501 | 0.09478378 | 0.58623123 |
19 | 524288 | 357479 | 46535 | 310944 | 0.68183708 | 0.08875847 | 0.59307861 |
20 | 1048576 | 715613 | 87963 | 627650 | 0.68246174 | 0.08388805 | 0.59857368 |
21 | 2097152 | 1432313 | 166950 | 1265363 | 0.68298006 | 0.07960796 | 0.6033721 |
22 | 4194304 | 2867066 | 316621 | 2550445 | 0.6835618 | 0.07548833 | 0.60807347 |
23 | 8388608 | 5736946 | 604137 | 5132809 | 0.68389726 | 0.07201874 | 0.61187851 |
24 | 16777216 | 11480061 | 1152743 | 10327318 | 0.68426496 | 0.06870884 | 0.61555612 |