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+108x-281
f(0)=281
f(1)=43
f(2)=61
f(3)=13
f(4)=167
f(5)=71
f(6)=31
f(7)=131
f(8)=647
f(9)=193
f(10)=29
f(11)=257
f(12)=19
f(13)=17
f(14)=1427
f(15)=23
f(16)=1
f(17)=461
f(18)=1987
f(19)=41
f(20)=53
f(21)=607
f(22)=2579
f(23)=683
f(24)=2887
f(25)=761
f(26)=3203
f(27)=1
f(28)=3527
f(29)=1
f(30)=227
f(31)=1
f(32)=1
f(33)=1093
f(34)=4547
f(35)=1181
f(36)=4903
f(37)=1
f(38)=229
f(39)=47
f(40)=5639
f(41)=1
f(42)=463
f(43)=1553
f(44)=149
f(45)=127
f(46)=6803
f(47)=103
f(48)=7207
f(49)=109
f(50)=401
f(51)=1
f(52)=8039
f(53)=2063
f(54)=8467
f(55)=1
f(56)=307
f(57)=2281
f(58)=719
f(59)=2393
f(60)=239
f(61)=1
f(62)=10259
f(63)=1
f(64)=631
f(65)=2741
f(66)=659
f(67)=2861
f(68)=1
f(69)=157
f(70)=641
f(71)=1
f(72)=409
f(73)=1
f(74)=13187
f(75)=3361
f(76)=1
f(77)=3491
f(78)=347
f(79)=3623
f(80)=14759
f(81)=1
f(82)=15299
f(83)=1
f(84)=1
f(85)=139
f(86)=349
f(87)=97
f(88)=1
f(89)=1
f(90)=17539
f(91)=4457
f(92)=18119
f(93)=4603
f(94)=1439
f(95)=4751
f(96)=199
f(97)=1
f(98)=1171
f(99)=163
b) Substitution of the polynom
The polynom f(x)=x^2+108x-281 could be written as f(y)= y^2-3197 with x=y-54
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+54
f'(x)>2x+107