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-84x+467
f(0)=467
f(1)=3
f(2)=101
f(3)=7
f(4)=1
f(5)=1
f(6)=1
f(7)=1
f(8)=47
f(9)=13
f(10)=1
f(11)=1
f(12)=397
f(13)=19
f(14)=1
f(15)=71
f(16)=23
f(17)=1
f(18)=103
f(19)=1
f(20)=271
f(21)=107
f(22)=1
f(23)=1
f(24)=139
f(25)=1
f(26)=347
f(27)=67
f(28)=367
f(29)=1
f(30)=1153
f(31)=1
f(32)=1
f(33)=1
f(34)=137
f(35)=1
f(36)=97
f(37)=53
f(38)=61
f(39)=1
f(40)=431
f(41)=1
f(42)=1297
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)=1
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=1
f(75)=1
f(76)=1
f(77)=1
f(78)=1
f(79)=1
f(80)=1
f(81)=1
f(82)=1
f(83)=1
f(84)=1
f(85)=1
f(86)=1
f(87)=1
f(88)=1
f(89)=1
f(90)=1
f(91)=1
f(92)=401
f(93)=163
f(94)=1
f(95)=1
f(96)=1619
f(97)=1
f(98)=613
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-84x+467 could be written as f(y)= y^2-1297 with x=y+42
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-42
f'(x)>2x-85 with x > 36
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 | 4 | 1 | 3 | 1 | 0.25 | 0.75 |
3 | 8 | 5 | 1 | 4 | 0.625 | 0.125 | 0.5 |
4 | 16 | 10 | 2 | 8 | 0.625 | 0.125 | 0.5 |
5 | 32 | 18 | 3 | 15 | 0.5625 | 0.09375 | 0.46875 |
6 | 64 | 24 | 4 | 20 | 0.375 | 0.0625 | 0.3125 |
7 | 128 | 41 | 6 | 35 | 0.3203125 | 0.046875 | 0.2734375 |
8 | 256 | 110 | 16 | 94 | 0.4296875 | 0.0625 | 0.3671875 |
9 | 512 | 256 | 32 | 224 | 0.5 | 0.0625 | 0.4375 |
10 | 1024 | 551 | 55 | 496 | 0.53808594 | 0.05371094 | 0.484375 |
11 | 2048 | 1164 | 90 | 1074 | 0.56835938 | 0.04394531 | 0.52441406 |
12 | 4096 | 2404 | 169 | 2235 | 0.58691406 | 0.04125977 | 0.5456543 |
13 | 8192 | 4895 | 298 | 4597 | 0.59753418 | 0.03637695 | 0.56115723 |
14 | 16384 | 9999 | 535 | 9464 | 0.61029053 | 0.03265381 | 0.57763672 |
15 | 32768 | 20243 | 1009 | 19234 | 0.61776733 | 0.03079224 | 0.5869751 |
16 | 65536 | 40874 | 1909 | 38965 | 0.62368774 | 0.02912903 | 0.59455872 |
17 | 131072 | 82321 | 3613 | 78708 | 0.62805939 | 0.027565 | 0.60049438 |
18 | 262144 | 165579 | 6722 | 158857 | 0.63163376 | 0.0256424 | 0.60599136 |
19 | 524288 | 332984 | 12652 | 320332 | 0.63511658 | 0.02413177 | 0.6109848 |
20 | 1048576 | 669146 | 23869 | 645277 | 0.63814735 | 0.02276325 | 0.6153841 |
21 | 2097152 | 1344073 | 45285 | 1298788 | 0.64090395 | 0.02159357 | 0.61931038 |
22 | 4194304 | 2698763 | 86172 | 2612591 | 0.64343524 | 0.02054501 | 0.62289023 |
23 | 8388608 | 5416664 | 164685 | 5251979 | 0.64571667 | 0.01963198 | 0.62608469 |
24 | 16777216 | 10866957 | 314673 | 10552284 | 0.64772111 | 0.01875597 | 0.62896514 |