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-2557
f(0)=2557
f(1)=293
f(2)=2129
f(3)=239
f(4)=1693
f(5)=23
f(6)=1249
f(7)=1
f(8)=797
f(9)=71
f(10)=337
f(11)=13
f(12)=131
f(13)=1
f(14)=607
f(15)=53
f(16)=1091
f(17)=167
f(18)=1583
f(19)=229
f(20)=2083
f(21)=73
f(22)=2591
f(23)=89
f(24)=1
f(25)=421
f(26)=3631
f(27)=487
f(28)=181
f(29)=277
f(30)=4703
f(31)=311
f(32)=59
f(33)=691
f(34)=5807
f(35)=761
f(36)=1
f(37)=1
f(38)=1
f(39)=113
f(40)=7523
f(41)=977
f(42)=8111
f(43)=1051
f(44)=8707
f(45)=563
f(46)=9311
f(47)=601
f(48)=9923
f(49)=1279
f(50)=811
f(51)=1
f(52)=11171
f(53)=359
f(54)=11807
f(55)=379
f(56)=12451
f(57)=1597
f(58)=13103
f(59)=1
f(60)=13763
f(61)=881
f(62)=14431
f(63)=1
f(64)=15107
f(65)=1931
f(66)=15791
f(67)=2017
f(68)=1
f(69)=263
f(70)=17183
f(71)=137
f(72)=17891
f(73)=2281
f(74)=809
f(75)=2371
f(76)=1487
f(77)=1231
f(78)=20063
f(79)=1277
f(80)=1
f(81)=2647
f(82)=937
f(83)=2741
f(84)=22307
f(85)=709
f(86)=23071
f(87)=733
f(88)=211
f(89)=233
f(90)=24623
f(91)=1
f(92)=25411
f(93)=1613
f(94)=1
f(95)=1663
f(96)=27011
f(97)=149
f(98)=27823
f(99)=3529
b) Substitution of the polynom
The polynom f(x)=x^2+212x-2557 could be written as f(y)= y^2-13793 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+211