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+88x-577
f(0)=577
f(1)=61
f(2)=397
f(3)=19
f(4)=11
f(5)=7
f(6)=13
f(7)=1
f(8)=191
f(9)=37
f(10)=31
f(11)=1
f(12)=89
f(13)=23
f(14)=1
f(15)=1
f(16)=1087
f(17)=151
f(18)=1
f(19)=1
f(20)=1583
f(21)=107
f(22)=97
f(23)=1
f(24)=2111
f(25)=281
f(26)=1
f(27)=79
f(28)=2671
f(29)=1
f(30)=2963
f(31)=389
f(32)=251
f(33)=1
f(34)=3571
f(35)=233
f(36)=1
f(37)=1
f(38)=4211
f(39)=547
f(40)=59
f(41)=1
f(42)=257
f(43)=1
f(44)=5231
f(45)=1
f(46)=1
f(47)=103
f(48)=541
f(49)=1
f(50)=6323
f(51)=1
f(52)=6703
f(53)=431
f(54)=1013
f(55)=911
f(56)=7487
f(57)=1
f(58)=607
f(59)=1
f(60)=1
f(61)=1
f(62)=1
f(63)=1117
f(64)=9151
f(65)=1171
f(66)=9587
f(67)=613
f(68)=1433
f(69)=641
f(70)=953
f(71)=1
f(72)=353
f(73)=127
f(74)=11411
f(75)=1
f(76)=11887
f(77)=379
f(78)=139
f(79)=83
f(80)=677
f(81)=149
f(82)=1
f(83)=1
f(84)=1
f(85)=883
f(86)=14387
f(87)=1831
f(88)=1
f(89)=271
f(90)=15443
f(91)=491
f(92)=1453
f(93)=1
f(94)=1
f(95)=1
f(96)=2441
f(97)=167
f(98)=929
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+88x-577 could be written as f(y)= y^2-2513 with x=y-44
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+44
f'(x)>2x+87