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+144x-337
f(0)=337
f(1)=3
f(2)=5
f(3)=13
f(4)=17
f(5)=1
f(6)=563
f(7)=1
f(8)=293
f(9)=1
f(10)=401
f(11)=19
f(12)=307
f(13)=71
f(14)=1
f(15)=1
f(16)=1
f(17)=1
f(18)=2579
f(19)=23
f(20)=109
f(21)=1
f(22)=1
f(23)=73
f(24)=739
f(25)=1
f(26)=1361
f(27)=107
f(28)=1493
f(29)=1
f(30)=257
f(31)=53
f(32)=353
f(33)=43
f(34)=127
f(35)=1
f(36)=6143
f(37)=1
f(38)=1
f(39)=1
f(40)=2341
f(41)=151
f(42)=1
f(43)=1
f(44)=1
f(45)=1021
f(46)=2801
f(47)=1
f(48)=683
f(49)=1
f(50)=3121
f(51)=1201
f(52)=1
f(53)=421
f(54)=1
f(55)=1
f(56)=1
f(57)=139
f(58)=3793
f(59)=97
f(60)=11903
f(61)=1
f(62)=829
f(63)=397
f(64)=173
f(65)=1
f(66)=13523
f(67)=1
f(68)=1
f(69)=359
f(70)=1627
f(71)=311
f(72)=179
f(73)=1
f(74)=1
f(75)=2011
f(76)=1
f(77)=1
f(78)=16979
f(79)=1
f(80)=5861
f(81)=1
f(82)=1213
f(83)=1
f(84)=1
f(85)=797
f(86)=6481
f(87)=1
f(88)=1
f(89)=1
f(90)=1
f(91)=877
f(92)=1
f(93)=2713
f(94)=113
f(95)=233
f(96)=1
f(97)=1
f(98)=7793
f(99)=593
b) Substitution of the polynom
The polynom f(x)=x^2+144x-337 could be written as f(y)= y^2-5521 with x=y-72
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+72
f'(x)>2x+143
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 | 1 | 2 | 1.5 | 0.5 | 1 |
2 | 4 | 5 | 1 | 4 | 1.25 | 0.25 | 1 |
3 | 8 | 7 | 2 | 5 | 0.875 | 0.25 | 0.625 |
4 | 16 | 11 | 2 | 9 | 0.6875 | 0.125 | 0.5625 |
5 | 32 | 22 | 3 | 19 | 0.6875 | 0.09375 | 0.59375 |
6 | 64 | 40 | 5 | 35 | 0.625 | 0.078125 | 0.546875 |
7 | 128 | 76 | 8 | 68 | 0.59375 | 0.0625 | 0.53125 |
8 | 256 | 144 | 11 | 133 | 0.5625 | 0.04296875 | 0.51953125 |
9 | 512 | 288 | 16 | 272 | 0.5625 | 0.03125 | 0.53125 |
10 | 1024 | 579 | 34 | 545 | 0.56542969 | 0.03320313 | 0.53222656 |
11 | 2048 | 1162 | 73 | 1089 | 0.56738281 | 0.03564453 | 0.53173828 |
12 | 4096 | 2338 | 136 | 2202 | 0.57080078 | 0.03320313 | 0.53759766 |
13 | 8192 | 4743 | 238 | 4505 | 0.57897949 | 0.02905273 | 0.54992676 |
14 | 16384 | 9632 | 416 | 9216 | 0.58789063 | 0.02539063 | 0.5625 |
15 | 32768 | 19495 | 777 | 18718 | 0.59494019 | 0.02371216 | 0.57122803 |
16 | 65536 | 39432 | 1449 | 37983 | 0.60168457 | 0.02210999 | 0.57957458 |
17 | 131072 | 79678 | 2676 | 77002 | 0.6078949 | 0.02041626 | 0.58747864 |
18 | 262144 | 160719 | 5052 | 155667 | 0.61309433 | 0.01927185 | 0.59382248 |
19 | 524288 | 323633 | 9583 | 314050 | 0.61728096 | 0.01827812 | 0.59900284 |
20 | 1048576 | 651591 | 18217 | 633374 | 0.6214056 | 0.01737309 | 0.60403252 |
21 | 2097152 | 1310421 | 34376 | 1276045 | 0.62485743 | 0.01639175 | 0.60846567 |
22 | 4194304 | 2634763 | 65214 | 2569549 | 0.62817645 | 0.01554823 | 0.61262822 |
23 | 8388608 | 5294625 | 124630 | 5169995 | 0.63116848 | 0.01485705 | 0.61631143 |
24 | 16777216 | 10635295 | 238381 | 10396914 | 0.63391298 | 0.01420861 | 0.61970437 |