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-797
f(0)=797
f(1)=23
f(2)=673
f(3)=19
f(4)=541
f(5)=59
f(6)=401
f(7)=41
f(8)=11
f(9)=1
f(10)=97
f(11)=1
f(12)=67
f(13)=1
f(14)=239
f(15)=1
f(16)=419
f(17)=1
f(18)=607
f(19)=1
f(20)=73
f(21)=113
f(22)=53
f(23)=139
f(24)=1
f(25)=83
f(26)=1439
f(27)=1
f(28)=1667
f(29)=223
f(30)=173
f(31)=1
f(32)=1
f(33)=71
f(34)=2399
f(35)=79
f(36)=2659
f(37)=349
f(38)=2927
f(39)=383
f(40)=3203
f(41)=1
f(42)=317
f(43)=227
f(44)=3779
f(45)=491
f(46)=4079
f(47)=1
f(48)=107
f(49)=1
f(50)=4703
f(51)=1
f(52)=457
f(53)=1
f(54)=233
f(55)=691
f(56)=1
f(57)=367
f(58)=6047
f(59)=389
f(60)=337
f(61)=823
f(62)=101
f(63)=1
f(64)=1
f(65)=229
f(66)=103
f(67)=241
f(68)=7907
f(69)=1013
f(70)=1
f(71)=1063
f(72)=8707
f(73)=557
f(74)=829
f(75)=1
f(76)=9539
f(77)=1
f(78)=9967
f(79)=1
f(80)=1
f(81)=1
f(82)=10847
f(83)=1
f(84)=11299
f(85)=131
f(86)=1069
f(87)=1499
f(88)=12227
f(89)=1
f(90)=12703
f(91)=809
f(92)=13187
f(93)=1
f(94)=13679
f(95)=1741
f(96)=1289
f(97)=1
f(98)=773
f(99)=467
b) Substitution of the polynom
The polynom f(x)=x^2+60x-797 could be written as f(y)= y^2-1697 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+59
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 | 4 | 5 | 1.125 | 0.5 | 0.625 |
4 | 16 | 13 | 8 | 5 | 0.8125 | 0.5 | 0.3125 |
5 | 32 | 23 | 11 | 12 | 0.71875 | 0.34375 | 0.375 |
6 | 64 | 47 | 19 | 28 | 0.734375 | 0.296875 | 0.4375 |
7 | 128 | 91 | 33 | 58 | 0.7109375 | 0.2578125 | 0.453125 |
8 | 256 | 177 | 58 | 119 | 0.69140625 | 0.2265625 | 0.46484375 |
9 | 512 | 346 | 100 | 246 | 0.67578125 | 0.1953125 | 0.48046875 |
10 | 1024 | 684 | 176 | 508 | 0.66796875 | 0.171875 | 0.49609375 |
11 | 2048 | 1375 | 316 | 1059 | 0.67138672 | 0.15429688 | 0.51708984 |
12 | 4096 | 2740 | 568 | 2172 | 0.66894531 | 0.13867188 | 0.53027344 |
13 | 8192 | 5508 | 1055 | 4453 | 0.67236328 | 0.12878418 | 0.5435791 |
14 | 16384 | 11027 | 1971 | 9056 | 0.67303467 | 0.12030029 | 0.55273438 |
15 | 32768 | 22120 | 3656 | 18464 | 0.67504883 | 0.11157227 | 0.56347656 |
16 | 65536 | 44279 | 6814 | 37465 | 0.67564392 | 0.10397339 | 0.57167053 |
17 | 131072 | 88791 | 12649 | 76142 | 0.67742157 | 0.09650421 | 0.58091736 |
18 | 262144 | 177847 | 23649 | 154198 | 0.67843246 | 0.09021378 | 0.58821869 |
19 | 524288 | 356168 | 44524 | 311644 | 0.67933655 | 0.08492279 | 0.59441376 |
20 | 1048576 | 712863 | 84362 | 628501 | 0.67983913 | 0.08045387 | 0.59938526 |
21 | 2097152 | 1426894 | 160277 | 1266617 | 0.68039608 | 0.07642603 | 0.60397005 |
22 | 4194304 | 2856072 | 304291 | 2551781 | 0.68094063 | 0.07254863 | 0.608392 |
23 | 8388608 | 5716887 | 580223 | 5136664 | 0.68150604 | 0.06916797 | 0.61233807 |
24 | 16777216 | 11441822 | 1108098 | 10333724 | 0.68198574 | 0.06604779 | 0.61593795 |