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+136x-233
f(0)=233
f(1)=3
f(2)=43
f(3)=23
f(4)=109
f(5)=59
f(6)=619
f(7)=1
f(8)=919
f(9)=67
f(10)=409
f(11)=173
f(12)=1543
f(13)=71
f(14)=1867
f(15)=127
f(16)=733
f(17)=37
f(18)=2539
f(19)=113
f(20)=2887
f(21)=383
f(22)=47
f(23)=107
f(24)=3607
f(25)=79
f(26)=1
f(27)=521
f(28)=1453
f(29)=569
f(30)=101
f(31)=103
f(32)=139
f(33)=167
f(34)=1
f(35)=719
f(36)=1
f(37)=257
f(38)=6379
f(39)=1
f(40)=2269
f(41)=439
f(42)=7243
f(43)=311
f(44)=7687
f(45)=1
f(46)=2713
f(47)=523
f(48)=8599
f(49)=1
f(50)=9067
f(51)=1163
f(52)=3181
f(53)=1223
f(54)=271
f(55)=1
f(56)=157
f(57)=673
f(58)=3673
f(59)=1409
f(60)=11527
f(61)=491
f(62)=12043
f(63)=769
f(64)=1
f(65)=401
f(66)=13099
f(67)=557
f(68)=593
f(69)=1
f(70)=4729
f(71)=1
f(72)=641
f(73)=313
f(74)=15307
f(75)=1949
f(76)=1
f(77)=1
f(78)=151
f(79)=349
f(80)=17047
f(81)=1
f(82)=5881
f(83)=2243
f(84)=1
f(85)=773
f(86)=18859
f(87)=599
f(88)=1
f(89)=1237
f(90)=20107
f(91)=1
f(92)=20743
f(93)=2633
f(94)=7129
f(95)=1
f(96)=22039
f(97)=1
f(98)=22699
f(99)=2879
b) Substitution of the polynom
The polynom f(x)=x^2+136x-233 could be written as f(y)= y^2-4857 with x=y-68
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+68
f'(x)>2x+135