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-268x+683
f(0)=683
f(1)=13
f(2)=151
f(3)=7
f(4)=373
f(5)=79
f(6)=127
f(7)=11
f(8)=1
f(9)=103
f(10)=271
f(11)=67
f(12)=2389
f(13)=47
f(14)=17
f(15)=389
f(16)=197
f(17)=1
f(18)=347
f(19)=23
f(20)=1
f(21)=563
f(22)=4729
f(23)=619
f(24)=739
f(25)=337
f(26)=71
f(27)=1
f(28)=6037
f(29)=1
f(30)=587
f(31)=1
f(32)=6869
f(33)=1
f(34)=1039
f(35)=467
f(36)=7669
f(37)=983
f(38)=1151
f(39)=1031
f(40)=59
f(41)=1
f(42)=383
f(43)=281
f(44)=9173
f(45)=167
f(46)=733
f(47)=1213
f(48)=83
f(49)=157
f(50)=601
f(51)=1
f(52)=137
f(53)=1
f(54)=131
f(55)=1
f(56)=1
f(57)=709
f(58)=11497
f(59)=1
f(60)=251
f(61)=1493
f(62)=1
f(63)=139
f(64)=12373
f(65)=1
f(66)=1
f(67)=1
f(68)=12917
f(69)=233
f(70)=13177
f(71)=1663
f(72)=1033
f(73)=1
f(74)=113
f(75)=431
f(76)=1987
f(77)=1753
f(78)=211
f(79)=1
f(80)=293
f(81)=1
f(82)=857
f(83)=1
f(84)=1
f(85)=1
f(86)=14969
f(87)=269
f(88)=659
f(89)=953
f(90)=313
f(91)=241
f(92)=1193
f(93)=1949
f(94)=2239
f(95)=179
f(96)=1439
f(97)=1
f(98)=1229
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-268x+683 could be written as f(y)= y^2-17273 with x=y+134
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-134
f'(x)>2x-269 with x > 131