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+32x-307
f(0)=307
f(1)=137
f(2)=239
f(3)=101
f(4)=163
f(5)=61
f(6)=79
f(7)=17
f(8)=13
f(9)=31
f(10)=113
f(11)=83
f(12)=1
f(13)=139
f(14)=337
f(15)=199
f(16)=461
f(17)=263
f(18)=593
f(19)=331
f(20)=733
f(21)=1
f(22)=881
f(23)=479
f(24)=1
f(25)=43
f(26)=1201
f(27)=643
f(28)=1373
f(29)=1
f(30)=1553
f(31)=823
f(32)=1741
f(33)=919
f(34)=149
f(35)=1019
f(36)=2141
f(37)=1123
f(38)=181
f(39)=1231
f(40)=1
f(41)=1
f(42)=2801
f(43)=1459
f(44)=3037
f(45)=1579
f(46)=193
f(47)=131
f(48)=3533
f(49)=1831
f(50)=3793
f(51)=151
f(52)=1
f(53)=2099
f(54)=4337
f(55)=2239
f(56)=4621
f(57)=2383
f(58)=1
f(59)=2531
f(60)=401
f(61)=2683
f(62)=5521
f(63)=167
f(64)=449
f(65)=2999
f(66)=1
f(67)=3163
f(68)=1
f(69)=3331
f(70)=6833
f(71)=1
f(72)=1
f(73)=283
f(74)=7537
f(75)=227
f(76)=7901
f(77)=311
f(78)=8273
f(79)=4231
f(80)=509
f(81)=4423
f(82)=9041
f(83)=1
f(84)=9437
f(85)=1
f(86)=757
f(87)=5023
f(88)=10253
f(89)=5231
f(90)=821
f(91)=5443
f(92)=653
f(93)=5659
f(94)=1
f(95)=5879
f(96)=11981
f(97)=359
f(98)=12433
f(99)=487
b) Substitution of the polynom
The polynom f(x)=x^2+32x-307 could be written as f(y)= y^2-563 with x=y-16
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+16
f'(x)>2x+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 | 16 | 8 | 8 | 1 | 0.5 | 0.5 |
5 | 32 | 29 | 15 | 14 | 0.90625 | 0.46875 | 0.4375 |
6 | 64 | 57 | 23 | 34 | 0.890625 | 0.359375 | 0.53125 |
7 | 128 | 107 | 40 | 67 | 0.8359375 | 0.3125 | 0.5234375 |
8 | 256 | 214 | 69 | 145 | 0.8359375 | 0.26953125 | 0.56640625 |
9 | 512 | 419 | 120 | 299 | 0.81835938 | 0.234375 | 0.58398438 |
10 | 1024 | 815 | 212 | 603 | 0.79589844 | 0.20703125 | 0.58886719 |
11 | 2048 | 1607 | 387 | 1220 | 0.78466797 | 0.18896484 | 0.59570313 |
12 | 4096 | 3171 | 690 | 2481 | 0.77416992 | 0.16845703 | 0.60571289 |
13 | 8192 | 6266 | 1262 | 5004 | 0.76489258 | 0.15405273 | 0.61083984 |
14 | 16384 | 12406 | 2319 | 10087 | 0.75720215 | 0.14154053 | 0.61566162 |
15 | 32768 | 24652 | 4271 | 20381 | 0.75231934 | 0.13034058 | 0.62197876 |
16 | 65536 | 49027 | 7948 | 41079 | 0.74809265 | 0.12127686 | 0.6268158 |
17 | 131072 | 97428 | 14891 | 82537 | 0.74331665 | 0.11360931 | 0.62970734 |
18 | 262144 | 194099 | 27806 | 166293 | 0.74042892 | 0.10607147 | 0.63435745 |
19 | 524288 | 386907 | 52209 | 334698 | 0.73796654 | 0.09958076 | 0.63838577 |
20 | 1048576 | 771543 | 98716 | 672827 | 0.73580074 | 0.09414291 | 0.64165783 |
21 | 2097152 | 1538735 | 187351 | 1351384 | 0.73372602 | 0.08933592 | 0.64439011 |
22 | 4194304 | 3069558 | 356483 | 2713075 | 0.73183966 | 0.08499217 | 0.64684749 |
23 | 8388608 | 6123853 | 679860 | 5443993 | 0.73002017 | 0.08104563 | 0.64897454 |
24 | 16777216 | 12220962 | 1298754 | 10922208 | 0.7284261 | 0.07741177 | 0.65101433 |