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-304x+607
f(0)=607
f(1)=19
f(2)=3
f(3)=37
f(4)=593
f(5)=1
f(6)=1181
f(7)=23
f(8)=587
f(9)=1
f(10)=2333
f(11)=109
f(12)=2897
f(13)=397
f(14)=1151
f(15)=233
f(16)=4001
f(17)=89
f(18)=239
f(19)=601
f(20)=1
f(21)=29
f(22)=193
f(23)=61
f(24)=6113
f(25)=199
f(26)=2207
f(27)=859
f(28)=7121
f(29)=307
f(30)=331
f(31)=491
f(32)=2699
f(33)=521
f(34)=8573
f(35)=367
f(36)=9041
f(37)=1
f(38)=3167
f(39)=1
f(40)=269
f(41)=53
f(42)=281
f(43)=1327
f(44)=157
f(45)=1381
f(46)=11261
f(47)=1
f(48)=11681
f(49)=743
f(50)=139
f(51)=1
f(52)=12497
f(53)=1
f(54)=12893
f(55)=409
f(56)=1
f(57)=421
f(58)=719
f(59)=577
f(60)=14033
f(61)=1777
f(62)=4799
f(63)=911
f(64)=14753
f(65)=311
f(66)=15101
f(67)=83
f(68)=5147
f(69)=1951
f(70)=15773
f(71)=1
f(72)=16097
f(73)=127
f(74)=5471
f(75)=1
f(76)=727
f(77)=1
f(78)=17021
f(79)=1
f(80)=1
f(81)=1091
f(82)=17597
f(83)=739
f(84)=293
f(85)=2251
f(86)=6047
f(87)=571
f(88)=18401
f(89)=1
f(90)=811
f(91)=2347
f(92)=6299
f(93)=2377
f(94)=1
f(95)=401
f(96)=1019
f(97)=1217
f(98)=107
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-304x+607 could be written as f(y)= y^2-22497 with x=y+152
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-152
f'(x)>2x-305 with x > 150