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-212x+659
f(0)=659
f(1)=7
f(2)=239
f(3)=1
f(4)=173
f(5)=47
f(6)=577
f(7)=97
f(8)=139
f(9)=73
f(10)=1361
f(11)=1
f(12)=1741
f(13)=241
f(14)=2113
f(15)=41
f(16)=2477
f(17)=83
f(18)=2833
f(19)=1
f(20)=3181
f(21)=419
f(22)=503
f(23)=461
f(24)=3853
f(25)=251
f(26)=4177
f(27)=271
f(28)=4493
f(29)=1
f(30)=4801
f(31)=619
f(32)=5101
f(33)=1
f(34)=5393
f(35)=1
f(36)=811
f(37)=727
f(38)=5953
f(39)=761
f(40)=6221
f(41)=397
f(42)=6481
f(43)=59
f(44)=6733
f(45)=857
f(46)=6977
f(47)=887
f(48)=7213
f(49)=229
f(50)=1063
f(51)=1
f(52)=163
f(53)=971
f(54)=7873
f(55)=997
f(56)=197
f(57)=1
f(58)=8273
f(59)=523
f(60)=8461
f(61)=1069
f(62)=8641
f(63)=1091
f(64)=1259
f(65)=1
f(66)=191
f(67)=283
f(68)=9133
f(69)=1151
f(70)=9281
f(71)=167
f(72)=9421
f(73)=593
f(74)=233
f(75)=601
f(76)=9677
f(77)=1217
f(78)=1399
f(79)=1231
f(80)=9901
f(81)=311
f(82)=137
f(83)=157
f(84)=10093
f(85)=181
f(86)=10177
f(87)=1277
f(88)=10253
f(89)=643
f(90)=10321
f(91)=647
f(92)=1483
f(93)=1301
f(94)=10433
f(95)=1307
f(96)=10477
f(97)=1
f(98)=10513
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-212x+659 could be written as f(y)= y^2-10577 with x=y+106
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-106
f'(x)>2x-213 with x > 103