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+48x-311
f(0)=311
f(1)=131
f(2)=211
f(3)=79
f(4)=103
f(5)=23
f(6)=13
f(7)=37
f(8)=137
f(9)=101
f(10)=269
f(11)=1
f(12)=409
f(13)=241
f(14)=557
f(15)=317
f(16)=31
f(17)=397
f(18)=877
f(19)=1
f(20)=1049
f(21)=569
f(22)=1229
f(23)=661
f(24)=109
f(25)=757
f(26)=1613
f(27)=857
f(28)=1
f(29)=1
f(30)=2029
f(31)=1069
f(32)=173
f(33)=1181
f(34)=2477
f(35)=1297
f(36)=2713
f(37)=1
f(38)=2957
f(39)=67
f(40)=3209
f(41)=1669
f(42)=3469
f(43)=1801
f(44)=1
f(45)=149
f(46)=4013
f(47)=1
f(48)=4297
f(49)=2221
f(50)=353
f(51)=1
f(52)=4889
f(53)=2521
f(54)=5197
f(55)=2677
f(56)=1
f(57)=2837
f(58)=449
f(59)=3001
f(60)=199
f(61)=3169
f(62)=283
f(63)=257
f(64)=6857
f(65)=3517
f(66)=7213
f(67)=3697
f(68)=7577
f(69)=3881
f(70)=7949
f(71)=313
f(72)=8329
f(73)=4261
f(74)=379
f(75)=4457
f(76)=701
f(77)=4657
f(78)=307
f(79)=4861
f(80)=9929
f(81)=1
f(82)=1
f(83)=5281
f(84)=829
f(85)=239
f(86)=11213
f(87)=5717
f(88)=11657
f(89)=457
f(90)=12109
f(91)=1
f(92)=12569
f(93)=1
f(94)=13037
f(95)=6637
f(96)=13513
f(97)=1
f(98)=13997
f(99)=7121
b) Substitution of the polynom
The polynom f(x)=x^2+48x-311 could be written as f(y)= y^2-887 with x=y-24
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+24
f'(x)>2x+47
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 | 13 | 16 | 0.90625 | 0.40625 | 0.5 |
6 | 64 | 56 | 23 | 33 | 0.875 | 0.359375 | 0.515625 |
7 | 128 | 111 | 41 | 70 | 0.8671875 | 0.3203125 | 0.546875 |
8 | 256 | 221 | 75 | 146 | 0.86328125 | 0.29296875 | 0.5703125 |
9 | 512 | 428 | 133 | 295 | 0.8359375 | 0.25976563 | 0.57617188 |
10 | 1024 | 841 | 227 | 614 | 0.82128906 | 0.22167969 | 0.59960938 |
11 | 2048 | 1650 | 407 | 1243 | 0.80566406 | 0.19873047 | 0.60693359 |
12 | 4096 | 3239 | 757 | 2482 | 0.79077148 | 0.18481445 | 0.60595703 |
13 | 8192 | 6425 | 1377 | 5048 | 0.78430176 | 0.16809082 | 0.61621094 |
14 | 16384 | 12695 | 2541 | 10154 | 0.77484131 | 0.15509033 | 0.61975098 |
15 | 32768 | 25150 | 4704 | 20446 | 0.76751709 | 0.14355469 | 0.6239624 |
16 | 65536 | 49922 | 8715 | 41207 | 0.76174927 | 0.13298035 | 0.62876892 |
17 | 131072 | 99333 | 16097 | 83236 | 0.75785065 | 0.12281036 | 0.63504028 |
18 | 262144 | 197523 | 30224 | 167299 | 0.75349045 | 0.11529541 | 0.63819504 |
19 | 524288 | 393490 | 56726 | 336764 | 0.75052261 | 0.10819626 | 0.64232635 |
20 | 1048576 | 783568 | 106900 | 676668 | 0.74726868 | 0.10194778 | 0.64532089 |
21 | 2097152 | 1561326 | 202936 | 1358390 | 0.74449825 | 0.09676743 | 0.64773083 |
22 | 4194304 | 3111389 | 386432 | 2724957 | 0.74181294 | 0.09213257 | 0.64968038 |
23 | 8388608 | 6204663 | 736337 | 5468326 | 0.73965347 | 0.08777821 | 0.65187526 |
24 | 16777216 | 12375139 | 1405572 | 10969567 | 0.73761576 | 0.08377862 | 0.65383714 |