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-238x+557
f(0)=557
f(1)=5
f(2)=17
f(3)=37
f(4)=379
f(5)=19
f(6)=167
f(7)=53
f(8)=1283
f(9)=47
f(10)=1723
f(11)=97
f(12)=431
f(13)=1
f(14)=2579
f(15)=41
f(16)=599
f(17)=1
f(18)=83
f(19)=1
f(20)=3803
f(21)=1
f(22)=839
f(23)=1097
f(24)=241
f(25)=149
f(26)=991
f(27)=257
f(28)=5323
f(29)=43
f(30)=5683
f(31)=293
f(32)=71
f(33)=1
f(34)=6379
f(35)=1637
f(36)=79
f(37)=1
f(38)=7043
f(39)=1801
f(40)=199
f(41)=1
f(42)=307
f(43)=103
f(44)=101
f(45)=127
f(46)=331
f(47)=421
f(48)=8563
f(49)=1
f(50)=239
f(51)=449
f(52)=1823
f(53)=1
f(54)=113
f(55)=2377
f(56)=1
f(57)=61
f(58)=9883
f(59)=1
f(60)=191
f(61)=1
f(62)=109
f(63)=2617
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=11003
f(69)=347
f(70)=659
f(71)=1
f(72)=1
f(73)=359
f(74)=11579
f(75)=2917
f(76)=2351
f(77)=1
f(78)=11923
f(79)=3001
f(80)=281
f(81)=1
f(82)=2447
f(83)=181
f(84)=12379
f(85)=389
f(86)=2503
f(87)=1
f(88)=269
f(89)=397
f(90)=12763
f(91)=641
f(92)=1
f(93)=1
f(94)=12979
f(95)=3257
f(96)=523
f(97)=1
f(98)=13163
f(99)=3301
b) Substitution of the polynom
The polynom f(x)=x^2-238x+557 could be written as f(y)= y^2-13604 with x=y+119
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-119
f'(x)>2x-239 with x > 117