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+292x-677
f(0)=677
f(1)=3
f(2)=89
f(3)=13
f(4)=1
f(5)=101
f(6)=11
f(7)=59
f(8)=1723
f(9)=127
f(10)=71
f(11)=83
f(12)=2971
f(13)=137
f(14)=3607
f(15)=491
f(16)=109
f(17)=1
f(18)=4903
f(19)=1
f(20)=5563
f(21)=67
f(22)=31
f(23)=821
f(24)=6907
f(25)=151
f(26)=7591
f(27)=1
f(28)=251
f(29)=1
f(30)=691
f(31)=389
f(32)=881
f(33)=157
f(34)=3469
f(35)=673
f(36)=11131
f(37)=479
f(38)=11863
f(39)=139
f(40)=4201
f(41)=811
f(42)=79
f(43)=1
f(44)=14107
f(45)=1811
f(46)=4957
f(47)=1907
f(48)=15643
f(49)=167
f(50)=1493
f(51)=1051
f(52)=5737
f(53)=1
f(54)=1637
f(55)=1
f(56)=1447
f(57)=1201
f(58)=211
f(59)=313
f(60)=20443
f(61)=1
f(62)=239
f(63)=2711
f(64)=7369
f(65)=1
f(66)=1
f(67)=487
f(68)=1831
f(69)=233
f(70)=8221
f(71)=3137
f(72)=1
f(73)=541
f(74)=26407
f(75)=839
f(76)=827
f(77)=3467
f(78)=28183
f(79)=1193
f(80)=229
f(81)=1
f(82)=769
f(83)=173
f(84)=997
f(85)=1307
f(86)=1
f(87)=367
f(88)=163
f(89)=1
f(90)=33703
f(91)=1
f(92)=34651
f(93)=4391
f(94)=1
f(95)=347
f(96)=36571
f(97)=193
f(98)=3413
f(99)=2377
b) Substitution of the polynom
The polynom f(x)=x^2+292x-677 could be written as f(y)= y^2-21993 with x=y-146
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+146
f'(x)>2x+291