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-276x+1811
f(0)=1811
f(1)=3
f(2)=421
f(3)=31
f(4)=241
f(5)=19
f(6)=191
f(7)=1
f(8)=37
f(9)=1
f(10)=283
f(11)=23
f(12)=59
f(13)=67
f(14)=619
f(15)=263
f(16)=29
f(17)=1
f(18)=2833
f(19)=1
f(20)=1103
f(21)=443
f(22)=1259
f(23)=167
f(24)=223
f(25)=1
f(26)=521
f(27)=307
f(28)=1
f(29)=1
f(30)=5569
f(31)=1
f(32)=1999
f(33)=97
f(34)=1
f(35)=1
f(36)=6829
f(37)=293
f(38)=2411
f(39)=929
f(40)=2543
f(41)=163
f(42)=8017
f(43)=1
f(44)=311
f(45)=1
f(46)=79
f(47)=373
f(48)=9133
f(49)=1
f(50)=3163
f(51)=151
f(52)=1093
f(53)=139
f(54)=10177
f(55)=431
f(56)=113
f(57)=1
f(58)=157
f(59)=229
f(60)=11149
f(61)=1
f(62)=1
f(63)=1451
f(64)=3919
f(65)=1
f(66)=12049
f(67)=127
f(68)=4111
f(69)=1559
f(70)=467
f(71)=1
f(72)=1
f(73)=271
f(74)=1
f(75)=829
f(76)=4463
f(77)=563
f(78)=13633
f(79)=1
f(80)=1
f(81)=1
f(82)=1
f(83)=1
f(84)=103
f(85)=601
f(86)=1
f(87)=1
f(88)=1637
f(89)=1
f(90)=14929
f(91)=313
f(92)=5039
f(93)=1901
f(94)=5099
f(95)=641
f(96)=499
f(97)=1
f(98)=193
f(99)=491
b) Substitution of the polynom
The polynom f(x)=x^2-276x+1811 could be written as f(y)= y^2-17233 with x=y+138
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-138
f'(x)>2x-277 with x > 131