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-176x+367
f(0)=367
f(1)=3
f(2)=19
f(3)=1
f(4)=107
f(5)=61
f(6)=653
f(7)=17
f(8)=977
f(9)=71
f(10)=431
f(11)=181
f(12)=1601
f(13)=73
f(14)=1901
f(15)=1
f(16)=43
f(17)=1
f(18)=2477
f(19)=109
f(20)=2753
f(21)=1
f(22)=53
f(23)=197
f(24)=193
f(25)=1
f(26)=3533
f(27)=457
f(28)=1259
f(29)=487
f(30)=4013
f(31)=1
f(32)=4241
f(33)=1
f(34)=1487
f(35)=571
f(36)=4673
f(37)=199
f(38)=4877
f(39)=311
f(40)=89
f(41)=1
f(42)=5261
f(43)=223
f(44)=5441
f(45)=691
f(46)=1871
f(47)=1
f(48)=1
f(49)=1
f(50)=349
f(51)=751
f(52)=2027
f(53)=769
f(54)=6221
f(55)=131
f(56)=6353
f(57)=401
f(58)=127
f(59)=1
f(60)=347
f(61)=277
f(62)=6701
f(63)=211
f(64)=2267
f(65)=1
f(66)=113
f(67)=1
f(68)=6977
f(69)=877
f(70)=2351
f(71)=443
f(72)=7121
f(73)=149
f(74)=167
f(75)=1
f(76)=2411
f(77)=907
f(78)=383
f(79)=1
f(80)=103
f(81)=229
f(82)=2447
f(83)=919
f(84)=433
f(85)=307
f(86)=101
f(87)=461
f(88)=2459
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-176x+367 could be written as f(y)= y^2-7377 with x=y+88
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-88
f'(x)>2x-177 with x > 86