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+1163
f(0)=1163
f(1)=31
f(2)=823
f(3)=41
f(4)=491
f(5)=1
f(6)=167
f(7)=1
f(8)=149
f(9)=19
f(10)=457
f(11)=1
f(12)=757
f(13)=113
f(14)=1049
f(15)=1
f(16)=43
f(17)=23
f(18)=1609
f(19)=109
f(20)=1877
f(21)=251
f(22)=2137
f(23)=283
f(24)=2389
f(25)=157
f(26)=2633
f(27)=1
f(28)=151
f(29)=373
f(30)=163
f(31)=401
f(32)=107
f(33)=1
f(34)=3529
f(35)=227
f(36)=3733
f(37)=479
f(38)=3929
f(39)=503
f(40)=179
f(41)=263
f(42)=4297
f(43)=137
f(44)=1
f(45)=569
f(46)=1
f(47)=1
f(48)=4789
f(49)=1
f(50)=4937
f(51)=313
f(52)=5077
f(53)=643
f(54)=5209
f(55)=659
f(56)=5333
f(57)=337
f(58)=5449
f(59)=1
f(60)=5557
f(61)=701
f(62)=5657
f(63)=1
f(64)=5749
f(65)=181
f(66)=307
f(67)=367
f(68)=311
f(69)=743
f(70)=139
f(71)=751
f(72)=6037
f(73)=379
f(74)=6089
f(75)=191
f(76)=6133
f(77)=769
f(78)=199
f(79)=773
f(80)=6197
f(81)=97
f(82)=6217
f(83)=389
f(84)=6229
f(85)=1
f(86)=271
f(87)=1
f(88)=1
f(89)=1
f(90)=1
f(91)=1
f(92)=1
f(93)=1
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=1
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-172x+1163 could be written as f(y)= y^2-6233 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-173 with x > 79