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+6x-113
f(0)=113
f(1)=53
f(2)=97
f(3)=43
f(4)=73
f(5)=29
f(6)=41
f(7)=11
f(8)=1
f(9)=1
f(10)=47
f(11)=37
f(12)=103
f(13)=67
f(14)=167
f(15)=101
f(16)=239
f(17)=139
f(18)=1
f(19)=181
f(20)=1
f(21)=227
f(22)=503
f(23)=277
f(24)=607
f(25)=331
f(26)=719
f(27)=389
f(28)=839
f(29)=1
f(30)=967
f(31)=1
f(32)=1103
f(33)=587
f(34)=1
f(35)=661
f(36)=1399
f(37)=739
f(38)=1559
f(39)=821
f(40)=157
f(41)=907
f(42)=173
f(43)=997
f(44)=2087
f(45)=1091
f(46)=1
f(47)=1
f(48)=1
f(49)=1291
f(50)=2687
f(51)=127
f(52)=2903
f(53)=137
f(54)=59
f(55)=1621
f(56)=3359
f(57)=1
f(58)=61
f(59)=1861
f(60)=3847
f(61)=1987
f(62)=373
f(63)=1
f(64)=397
f(65)=2251
f(66)=4639
f(67)=2389
f(68)=4919
f(69)=2531
f(70)=1
f(71)=2677
f(72)=5503
f(73)=257
f(74)=5807
f(75)=271
f(76)=211
f(77)=1
f(78)=1
f(79)=3301
f(80)=1
f(81)=3467
f(82)=7103
f(83)=3637
f(84)=677
f(85)=1
f(86)=709
f(87)=3989
f(88)=199
f(89)=1
f(90)=8527
f(91)=4357
f(92)=307
f(93)=4547
f(94)=251
f(95)=431
f(96)=9679
f(97)=449
f(98)=10079
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+6x-113 could be written as f(y)= y^2-122 with x=y-3
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+3
f'(x)>2x+5