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+2x-37
f(0)=37
f(1)=17
f(2)=29
f(3)=11
f(4)=13
f(5)=1
f(6)=1
f(7)=1
f(8)=43
f(9)=31
f(10)=83
f(11)=53
f(12)=131
f(13)=79
f(14)=1
f(15)=109
f(16)=251
f(17)=1
f(18)=19
f(19)=181
f(20)=1
f(21)=223
f(22)=491
f(23)=269
f(24)=587
f(25)=1
f(26)=691
f(27)=373
f(28)=73
f(29)=431
f(30)=71
f(31)=1
f(32)=1051
f(33)=1
f(34)=1187
f(35)=1
f(36)=1
f(37)=1
f(38)=1483
f(39)=1
f(40)=1
f(41)=863
f(42)=1811
f(43)=1
f(44)=1987
f(45)=1039
f(46)=167
f(47)=103
f(48)=139
f(49)=1231
f(50)=233
f(51)=1
f(52)=163
f(53)=1439
f(54)=1
f(55)=1549
f(56)=1
f(57)=1663
f(58)=313
f(59)=137
f(60)=127
f(61)=173
f(62)=3931
f(63)=2029
f(64)=1
f(65)=1
f(66)=4451
f(67)=2293
f(68)=4723
f(69)=1
f(70)=5003
f(71)=1
f(72)=1
f(73)=2719
f(74)=151
f(75)=1
f(76)=1
f(77)=3023
f(78)=6203
f(79)=3181
f(80)=593
f(81)=3343
f(82)=1
f(83)=1
f(84)=7187
f(85)=283
f(86)=443
f(87)=3853
f(88)=7883
f(89)=1
f(90)=8243
f(91)=383
f(92)=1
f(93)=1
f(94)=1
f(95)=353
f(96)=9371
f(97)=4783
f(98)=751
f(99)=293
b) Substitution of the polynom
The polynom f(x)=x^2+2x-37 could be written as f(y)= y^2-38 with x=y-1
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+1
f'(x)>2x+1