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+60x-1277
f(0)=1277
f(1)=19
f(2)=1153
f(3)=17
f(4)=1021
f(5)=7
f(6)=881
f(7)=101
f(8)=733
f(9)=41
f(10)=577
f(11)=31
f(12)=59
f(13)=1
f(14)=241
f(15)=1
f(16)=61
f(17)=1
f(18)=127
f(19)=1
f(20)=1
f(21)=53
f(22)=1
f(23)=79
f(24)=739
f(25)=1
f(26)=137
f(27)=67
f(28)=1187
f(29)=163
f(30)=1423
f(31)=193
f(32)=1667
f(33)=1
f(34)=1
f(35)=1
f(36)=2179
f(37)=1
f(38)=2447
f(39)=1
f(40)=389
f(41)=179
f(42)=97
f(43)=197
f(44)=3299
f(45)=431
f(46)=1
f(47)=1
f(48)=3907
f(49)=1
f(50)=103
f(51)=1
f(52)=4547
f(53)=1
f(54)=1
f(55)=631
f(56)=307
f(57)=337
f(58)=293
f(59)=359
f(60)=5923
f(61)=109
f(62)=6287
f(63)=809
f(64)=6659
f(65)=107
f(66)=7039
f(67)=113
f(68)=1061
f(69)=953
f(70)=7823
f(71)=1
f(72)=433
f(73)=1
f(74)=1
f(75)=1
f(76)=9059
f(77)=1
f(78)=1
f(79)=1213
f(80)=9923
f(81)=317
f(82)=1481
f(83)=331
f(84)=349
f(85)=1381
f(86)=11279
f(87)=1439
f(88)=691
f(89)=1
f(90)=719
f(91)=1
f(92)=131
f(93)=1619
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=14207
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+60x-1277 could be written as f(y)= y^2-2177 with x=y-30
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+30
f'(x)>2x+59