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-60x+379
f(0)=379
f(1)=5
f(2)=263
f(3)=13
f(4)=31
f(5)=1
f(6)=11
f(7)=1
f(8)=37
f(9)=1
f(10)=1
f(11)=1
f(12)=197
f(13)=29
f(14)=53
f(15)=1
f(16)=1
f(17)=1
f(18)=1
f(19)=1
f(20)=421
f(21)=1
f(22)=457
f(23)=59
f(24)=97
f(25)=1
f(26)=101
f(27)=1
f(28)=47
f(29)=1
f(30)=521
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)=1
f(47)=1
f(48)=1
f(49)=1
f(50)=1
f(51)=1
f(52)=1
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)=503
f(63)=71
f(64)=127
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=83
f(71)=1
f(72)=113
f(73)=1
f(74)=283
f(75)=1
f(76)=1
f(77)=211
f(78)=1783
f(79)=1
f(80)=1979
f(81)=1
f(82)=1
f(83)=1
f(84)=479
f(85)=313
f(86)=523
f(87)=1
f(88)=2843
f(89)=1
f(90)=3079
f(91)=1
f(92)=3323
f(93)=431
f(94)=1
f(95)=463
f(96)=1
f(97)=1
f(98)=373
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-60x+379 could be written as f(y)= y^2-521 with x=y+30
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-30
f'(x)>2x-61 with x > 23
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 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 7 | 3 | 4 | 0.875 | 0.375 | 0.5 |
4 | 16 | 10 | 4 | 6 | 0.625 | 0.25 | 0.375 |
5 | 32 | 17 | 7 | 10 | 0.53125 | 0.21875 | 0.3125 |
6 | 64 | 20 | 8 | 12 | 0.3125 | 0.125 | 0.1875 |
7 | 128 | 51 | 17 | 34 | 0.3984375 | 0.1328125 | 0.265625 |
8 | 256 | 131 | 32 | 99 | 0.51171875 | 0.125 | 0.38671875 |
9 | 512 | 292 | 56 | 236 | 0.5703125 | 0.109375 | 0.4609375 |
10 | 1024 | 608 | 111 | 497 | 0.59375 | 0.10839844 | 0.48535156 |
11 | 2048 | 1265 | 198 | 1067 | 0.61767578 | 0.09667969 | 0.52099609 |
12 | 4096 | 2572 | 372 | 2200 | 0.62792969 | 0.09082031 | 0.53710938 |
13 | 8192 | 5204 | 668 | 4536 | 0.63525391 | 0.08154297 | 0.55371094 |
14 | 16384 | 10516 | 1182 | 9334 | 0.6418457 | 0.07214355 | 0.56970215 |
15 | 32768 | 21212 | 2198 | 19014 | 0.64733887 | 0.06707764 | 0.58026123 |
16 | 65536 | 42682 | 4091 | 38591 | 0.65127563 | 0.06242371 | 0.58885193 |
17 | 131072 | 85680 | 7639 | 78041 | 0.65368652 | 0.05828094 | 0.59540558 |
18 | 262144 | 171960 | 14466 | 157494 | 0.65597534 | 0.05518341 | 0.60079193 |
19 | 524288 | 345005 | 27213 | 317792 | 0.65804482 | 0.05190468 | 0.60614014 |
20 | 1048576 | 691817 | 51512 | 640305 | 0.6597681 | 0.04912567 | 0.61064243 |
21 | 2097152 | 1386878 | 97888 | 1288990 | 0.66131496 | 0.04667664 | 0.61463833 |
22 | 4194304 | 2780394 | 185840 | 2594554 | 0.66289759 | 0.04430771 | 0.61858988 |
23 | 8388608 | 5572031 | 353966 | 5218065 | 0.66423786 | 0.04219604 | 0.62204182 |
24 | 16777216 | 11165909 | 675824 | 10490085 | 0.66554004 | 0.04028225 | 0.62525779 |