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-268x+3083
f(0)=3083
f(1)=11
f(2)=2551
f(3)=13
f(4)=2027
f(5)=17
f(6)=1511
f(7)=157
f(8)=59
f(9)=47
f(10)=503
f(11)=1
f(12)=1
f(13)=29
f(14)=43
f(15)=89
f(16)=73
f(17)=37
f(18)=109
f(19)=103
f(20)=1877
f(21)=263
f(22)=137
f(23)=1
f(24)=1
f(25)=1
f(26)=3209
f(27)=107
f(28)=3637
f(29)=1
f(30)=4057
f(31)=41
f(32)=1
f(33)=1
f(34)=443
f(35)=317
f(36)=479
f(37)=683
f(38)=5657
f(39)=1
f(40)=6037
f(41)=389
f(42)=1
f(43)=1
f(44)=521
f(45)=79
f(46)=7129
f(47)=83
f(48)=7477
f(49)=239
f(50)=7817
f(51)=499
f(52)=281
f(53)=1039
f(54)=229
f(55)=1
f(56)=1
f(57)=1
f(58)=827
f(59)=1
f(60)=9397
f(61)=1193
f(62)=9689
f(63)=1229
f(64)=9973
f(65)=1
f(66)=277
f(67)=1
f(68)=809
f(69)=1
f(70)=829
f(71)=1
f(72)=269
f(73)=1
f(74)=11273
f(75)=1
f(76)=677
f(77)=1453
f(78)=97
f(79)=1481
f(80)=1087
f(81)=1
f(82)=283
f(83)=1
f(84)=12373
f(85)=1559
f(86)=12569
f(87)=1583
f(88)=12757
f(89)=1
f(90)=761
f(91)=1
f(92)=13109
f(93)=1
f(94)=1021
f(95)=1669
f(96)=1033
f(97)=211
f(98)=13577
f(99)=853
b) Substitution of the polynom
The polynom f(x)=x^2-268x+3083 could be written as f(y)= y^2-14873 with x=y+134
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-134
f'(x)>2x-269 with x > 122