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-280x+1607
f(0)=1607
f(1)=83
f(2)=1051
f(3)=97
f(4)=503
f(5)=29
f(6)=37
f(7)=19
f(8)=569
f(9)=13
f(10)=1093
f(11)=1
f(12)=1609
f(13)=233
f(14)=73
f(15)=1
f(16)=2617
f(17)=179
f(18)=3109
f(19)=419
f(20)=3593
f(21)=479
f(22)=313
f(23)=269
f(24)=349
f(25)=149
f(26)=263
f(27)=653
f(28)=5449
f(29)=709
f(30)=71
f(31)=191
f(32)=6329
f(33)=409
f(34)=1
f(35)=67
f(36)=7177
f(37)=1
f(38)=7589
f(39)=487
f(40)=7993
f(41)=1
f(42)=8389
f(43)=1
f(44)=131
f(45)=59
f(46)=9157
f(47)=1
f(48)=733
f(49)=607
f(50)=761
f(51)=1259
f(52)=277
f(53)=1303
f(54)=10597
f(55)=673
f(56)=10937
f(57)=347
f(58)=1
f(59)=1429
f(60)=11593
f(61)=113
f(62)=11909
f(63)=1
f(64)=643
f(65)=773
f(66)=12517
f(67)=1583
f(68)=12809
f(69)=1619
f(70)=13093
f(71)=827
f(72)=461
f(73)=211
f(74)=1049
f(75)=1721
f(76)=1069
f(77)=1753
f(78)=14149
f(79)=223
f(80)=389
f(81)=907
f(82)=14629
f(83)=1
f(84)=1
f(85)=1871
f(86)=15077
f(87)=1
f(88)=15289
f(89)=1
f(90)=15493
f(91)=1949
f(92)=541
f(93)=1973
f(94)=15877
f(95)=499
f(96)=16057
f(97)=1009
f(98)=16229
f(99)=2039
b) Substitution of the polynom
The polynom f(x)=x^2-280x+1607 could be written as f(y)= y^2-17993 with x=y+140
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-140
f'(x)>2x-281 with x > 134