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+64x-3
f(0)=3
f(1)=31
f(2)=43
f(3)=11
f(4)=269
f(5)=19
f(6)=139
f(7)=13
f(8)=191
f(9)=109
f(10)=67
f(11)=137
f(12)=101
f(13)=499
f(14)=1
f(15)=197
f(16)=1277
f(17)=229
f(18)=491
f(19)=787
f(20)=1
f(21)=1
f(22)=1889
f(23)=37
f(24)=1
f(25)=1
f(26)=41
f(27)=409
f(28)=83
f(29)=449
f(30)=313
f(31)=1471
f(32)=1
f(33)=1
f(34)=3329
f(35)=577
f(36)=1
f(37)=1867
f(38)=1291
f(39)=223
f(40)=4157
f(41)=239
f(42)=1483
f(43)=1
f(44)=1583
f(45)=1
f(46)=389
f(47)=79
f(48)=199
f(49)=2767
f(50)=211
f(51)=977
f(52)=6029
f(53)=1033
f(54)=193
f(55)=3271
f(56)=2239
f(57)=383
f(58)=643
f(59)=1
f(60)=1
f(61)=103
f(62)=1
f(63)=1
f(64)=431
f(65)=127
f(66)=953
f(67)=107
f(68)=997
f(69)=1
f(70)=9377
f(71)=1597
f(72)=251
f(73)=4999
f(74)=1
f(75)=1
f(76)=967
f(77)=1
f(78)=3691
f(79)=5647
f(80)=349
f(81)=1
f(82)=11969
f(83)=1
f(84)=1381
f(85)=487
f(86)=1433
f(87)=1
f(88)=311
f(89)=2269
f(90)=149
f(91)=641
f(92)=4783
f(93)=811
f(94)=479
f(95)=839
f(96)=5119
f(97)=1
f(98)=1
f(99)=2689
b) Substitution of the polynom
The polynom f(x)=x^2+64x-3 could be written as f(y)= y^2-1027 with x=y-32
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+32
f'(x)>2x+63