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-180x+787
f(0)=787
f(1)=19
f(2)=431
f(3)=1
f(4)=83
f(5)=11
f(6)=257
f(7)=53
f(8)=31
f(9)=47
f(10)=1
f(11)=67
f(12)=1229
f(13)=173
f(14)=29
f(15)=211
f(16)=167
f(17)=1
f(18)=2129
f(19)=71
f(20)=127
f(21)=1
f(22)=2689
f(23)=353
f(24)=2957
f(25)=193
f(26)=3217
f(27)=1
f(28)=3469
f(29)=449
f(30)=79
f(31)=479
f(32)=359
f(33)=1
f(34)=4177
f(35)=1
f(36)=4397
f(37)=563
f(38)=419
f(39)=1
f(40)=4813
f(41)=307
f(42)=5009
f(43)=1
f(44)=5197
f(45)=661
f(46)=283
f(47)=683
f(48)=179
f(49)=1
f(50)=197
f(51)=181
f(52)=5869
f(53)=743
f(54)=547
f(55)=761
f(56)=131
f(57)=389
f(58)=331
f(59)=397
f(60)=1
f(61)=809
f(62)=6529
f(63)=823
f(64)=6637
f(65)=1
f(66)=6737
f(67)=1
f(68)=6829
f(69)=859
f(70)=223
f(71)=1
f(72)=241
f(73)=439
f(74)=7057
f(75)=443
f(76)=647
f(77)=1
f(78)=107
f(79)=1
f(80)=7213
f(81)=113
f(82)=659
f(83)=227
f(84)=383
f(85)=911
f(86)=7297
f(87)=1
f(88)=7309
f(89)=457
f(90)=103
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-180x+787 could be written as f(y)= y^2-7313 with x=y+90
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-90
f'(x)>2x-181 with x > 86