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+40x-607
f(0)=607
f(1)=283
f(2)=523
f(3)=239
f(4)=431
f(5)=191
f(6)=331
f(7)=139
f(8)=223
f(9)=83
f(10)=107
f(11)=23
f(12)=17
f(13)=41
f(14)=149
f(15)=109
f(16)=1
f(17)=181
f(18)=19
f(19)=257
f(20)=593
f(21)=337
f(22)=757
f(23)=421
f(24)=929
f(25)=509
f(26)=1109
f(27)=601
f(28)=1297
f(29)=1
f(30)=1493
f(31)=797
f(32)=1697
f(33)=53
f(34)=1
f(35)=1009
f(36)=2129
f(37)=59
f(38)=2357
f(39)=1237
f(40)=2593
f(41)=1
f(42)=2837
f(43)=1481
f(44)=3089
f(45)=1609
f(46)=197
f(47)=1741
f(48)=3617
f(49)=1877
f(50)=229
f(51)=2017
f(52)=4177
f(53)=2161
f(54)=1
f(55)=2309
f(56)=251
f(57)=1
f(58)=5077
f(59)=2617
f(60)=5393
f(61)=2777
f(62)=5717
f(63)=173
f(64)=263
f(65)=3109
f(66)=6389
f(67)=193
f(68)=6737
f(69)=3457
f(70)=1
f(71)=3637
f(72)=7457
f(73)=3821
f(74)=7829
f(75)=211
f(76)=8209
f(77)=4201
f(78)=8597
f(79)=4397
f(80)=1
f(81)=4597
f(82)=9397
f(83)=4801
f(84)=577
f(85)=5009
f(86)=1
f(87)=227
f(88)=10657
f(89)=5437
f(90)=11093
f(91)=5657
f(92)=1
f(93)=5881
f(94)=631
f(95)=1
f(96)=1
f(97)=373
f(98)=12917
f(99)=6577
b) Substitution of the polynom
The polynom f(x)=x^2+40x-607 could be written as f(y)= y^2-1007 with x=y-20
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+20
f'(x)>2x+39