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+172x-397
f(0)=397
f(1)=7
f(2)=1
f(3)=1
f(4)=307
f(5)=61
f(6)=11
f(7)=107
f(8)=149
f(9)=1
f(10)=1423
f(11)=101
f(12)=1811
f(13)=251
f(14)=2207
f(15)=43
f(16)=373
f(17)=1
f(18)=3023
f(19)=1
f(20)=313
f(21)=457
f(22)=79
f(23)=73
f(24)=59
f(25)=283
f(26)=4751
f(27)=311
f(28)=1
f(29)=97
f(30)=809
f(31)=67
f(32)=6131
f(33)=199
f(34)=6607
f(35)=1
f(36)=1013
f(37)=131
f(38)=7583
f(39)=89
f(40)=137
f(41)=521
f(42)=71
f(43)=1
f(44)=1301
f(45)=1171
f(46)=9631
f(47)=1237
f(48)=10163
f(49)=163
f(50)=139
f(51)=1
f(52)=11251
f(53)=1
f(54)=11807
f(55)=1511
f(56)=1
f(57)=113
f(58)=1
f(59)=827
f(60)=13523
f(61)=157
f(62)=103
f(63)=1801
f(64)=191
f(65)=1
f(66)=1
f(67)=1
f(68)=15923
f(69)=2029
f(70)=233
f(71)=1
f(72)=223
f(73)=1093
f(74)=17807
f(75)=1
f(76)=18451
f(77)=2347
f(78)=2729
f(79)=347
f(80)=19763
f(81)=1
f(82)=20431
f(83)=1
f(84)=21107
f(85)=383
f(86)=1
f(87)=2767
f(88)=22483
f(89)=1427
f(90)=239
f(91)=1471
f(92)=3413
f(93)=433
f(94)=2237
f(95)=3121
f(96)=1
f(97)=1
f(98)=389
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+172x-397 could be written as f(y)= y^2-7793 with x=y-86
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+86
f'(x)>2x+171
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 | 2 | 1 | 1 | 1 | 0.5 | 0.5 |
2 | 4 | 3 | 2 | 1 | 0.75 | 0.5 | 0.25 |
3 | 8 | 7 | 2 | 5 | 0.875 | 0.25 | 0.625 |
4 | 16 | 14 | 5 | 9 | 0.875 | 0.3125 | 0.5625 |
5 | 32 | 27 | 8 | 19 | 0.84375 | 0.25 | 0.59375 |
6 | 64 | 53 | 15 | 38 | 0.828125 | 0.234375 | 0.59375 |
7 | 128 | 95 | 25 | 70 | 0.7421875 | 0.1953125 | 0.546875 |
8 | 256 | 187 | 45 | 142 | 0.73046875 | 0.17578125 | 0.5546875 |
9 | 512 | 360 | 82 | 278 | 0.703125 | 0.16015625 | 0.54296875 |
10 | 1024 | 702 | 145 | 557 | 0.68554688 | 0.14160156 | 0.54394531 |
11 | 2048 | 1372 | 262 | 1110 | 0.66992188 | 0.12792969 | 0.54199219 |
12 | 4096 | 2734 | 484 | 2250 | 0.66748047 | 0.11816406 | 0.54931641 |
13 | 8192 | 5450 | 898 | 4552 | 0.6652832 | 0.10961914 | 0.55566406 |
14 | 16384 | 10878 | 1684 | 9194 | 0.66394043 | 0.1027832 | 0.56115723 |
15 | 32768 | 21840 | 3112 | 18728 | 0.66650391 | 0.0949707 | 0.5715332 |
16 | 65536 | 43809 | 5821 | 37988 | 0.66847229 | 0.08882141 | 0.57965088 |
17 | 131072 | 87805 | 10883 | 76922 | 0.66989899 | 0.0830307 | 0.58686829 |
18 | 262144 | 175969 | 20331 | 155638 | 0.67126846 | 0.07755661 | 0.59371185 |
19 | 524288 | 352728 | 38274 | 314454 | 0.67277527 | 0.07300186 | 0.59977341 |
20 | 1048576 | 706511 | 72348 | 634163 | 0.67378139 | 0.06899643 | 0.60478497 |
21 | 2097152 | 1414867 | 137536 | 1277331 | 0.67466116 | 0.06558228 | 0.60907888 |
22 | 4194304 | 2833149 | 261631 | 2571518 | 0.67547536 | 0.06237769 | 0.61309767 |
23 | 8388608 | 5672627 | 498172 | 5174455 | 0.67622983 | 0.05938673 | 0.6168431 |
24 | 16777216 | 11356933 | 952410 | 10404523 | 0.67692596 | 0.05676806 | 0.6201579 |