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+36x-7829
f(0)=7829
f(1)=487
f(2)=7753
f(3)=241
f(4)=7669
f(5)=953
f(6)=7577
f(7)=941
f(8)=7477
f(9)=29
f(10)=7369
f(11)=457
f(12)=7253
f(13)=31
f(14)=7129
f(15)=883
f(16)=6997
f(17)=433
f(18)=6857
f(19)=53
f(20)=6709
f(21)=829
f(22)=6553
f(23)=809
f(24)=6389
f(25)=197
f(26)=6217
f(27)=383
f(28)=6037
f(29)=743
f(30)=5849
f(31)=719
f(32)=5653
f(33)=347
f(34)=5449
f(35)=167
f(36)=5237
f(37)=641
f(38)=173
f(39)=613
f(40)=4789
f(41)=73
f(42)=157
f(43)=277
f(44)=139
f(45)=523
f(46)=4057
f(47)=491
f(48)=3797
f(49)=229
f(50)=3529
f(51)=1
f(52)=3253
f(53)=389
f(54)=2969
f(55)=353
f(56)=2677
f(57)=79
f(58)=2377
f(59)=1
f(60)=2069
f(61)=239
f(62)=1753
f(63)=199
f(64)=1429
f(65)=1
f(66)=1097
f(67)=1
f(68)=757
f(69)=1
f(70)=409
f(71)=1
f(72)=1
f(73)=1
f(74)=311
f(75)=1
f(76)=683
f(77)=109
f(78)=1063
f(79)=1
f(80)=1451
f(81)=103
f(82)=1847
f(83)=1
f(84)=2251
f(85)=307
f(86)=2663
f(87)=359
f(88)=3083
f(89)=1
f(90)=3511
f(91)=233
f(92)=3947
f(93)=521
f(94)=4391
f(95)=577
f(96)=1
f(97)=317
f(98)=5303
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2+36x-7829 could be written as f(y)= y^2-8153 with x=y-18
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+18
f'(x)>2x+35