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-24x+3607
f(0)=3607
f(1)=7
f(2)=509
f(3)=443
f(4)=3527
f(5)=439
f(6)=3499
f(7)=109
f(8)=71
f(9)=31
f(10)=3467
f(11)=433
f(12)=3463
f(13)=1
f(14)=1
f(15)=1
f(16)=1
f(17)=1
f(18)=1
f(19)=1
f(20)=1
f(21)=1
f(22)=1
f(23)=1
f(24)=1
f(25)=227
f(26)=3659
f(27)=461
f(28)=3719
f(29)=67
f(30)=541
f(31)=239
f(32)=3863
f(33)=61
f(34)=3947
f(35)=499
f(36)=577
f(37)=73
f(38)=4139
f(39)=131
f(40)=137
f(41)=269
f(42)=4363
f(43)=79
f(44)=641
f(45)=569
f(46)=149
f(47)=293
f(48)=4759
f(49)=151
f(50)=701
f(51)=89
f(52)=83
f(53)=643
f(54)=5227
f(55)=1
f(56)=5399
f(57)=1
f(58)=797
f(59)=709
f(60)=1
f(61)=733
f(62)=1
f(63)=379
f(64)=881
f(65)=1
f(66)=6379
f(67)=811
f(68)=6599
f(69)=839
f(70)=6827
f(71)=1
f(72)=1009
f(73)=449
f(74)=7307
f(75)=929
f(76)=7559
f(77)=1
f(78)=1117
f(79)=1
f(80)=8087
f(81)=257
f(82)=8363
f(83)=1063
f(84)=8647
f(85)=157
f(86)=1277
f(87)=1
f(88)=9239
f(89)=587
f(90)=9547
f(91)=1213
f(92)=1409
f(93)=179
f(94)=167
f(95)=647
f(96)=1
f(97)=1
f(98)=10859
f(99)=197
b) Substitution of the polynom
The polynom f(x)=x^2-24x+3607 could be written as f(y)= y^2+3463 with x=y+12
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-12
f'(x)>2x-25 with x > 59
A | B | C | D | E | F | G | H |
exponent =log2 (x) |
<=x | number of all primes |
number of primes p = f(x) |
number of primes p | f(x) |
C / x | D / x | E / x |
1 | 2 | 3 | 1 | 2 | 1.5 | 0.5 | 1 |
2 | 4 | 5 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 9 | 3 | 6 | 1.125 | 0.375 | 0.75 |
4 | 16 | 13 | 5 | 8 | 0.8125 | 0.3125 | 0.5 |
5 | 32 | 21 | 8 | 13 | 0.65625 | 0.25 | 0.40625 |
6 | 64 | 49 | 14 | 35 | 0.765625 | 0.21875 | 0.546875 |
7 | 128 | 99 | 29 | 70 | 0.7734375 | 0.2265625 | 0.546875 |
8 | 256 | 196 | 61 | 135 | 0.765625 | 0.23828125 | 0.52734375 |
9 | 512 | 381 | 111 | 270 | 0.74414063 | 0.21679688 | 0.52734375 |
10 | 1024 | 743 | 203 | 540 | 0.72558594 | 0.19824219 | 0.52734375 |
11 | 2048 | 1473 | 367 | 1106 | 0.71923828 | 0.17919922 | 0.54003906 |
12 | 4096 | 2931 | 652 | 2279 | 0.71557617 | 0.15917969 | 0.55639648 |
13 | 8192 | 5838 | 1192 | 4646 | 0.71264648 | 0.14550781 | 0.56713867 |
14 | 16384 | 11616 | 2198 | 9418 | 0.70898438 | 0.13415527 | 0.5748291 |
15 | 32768 | 23171 | 4093 | 19078 | 0.7071228 | 0.12490845 | 0.58221436 |
16 | 65536 | 46276 | 7591 | 38685 | 0.70611572 | 0.11582947 | 0.59028625 |
17 | 131072 | 92383 | 14205 | 78178 | 0.70482635 | 0.10837555 | 0.59645081 |
18 | 262144 | 184565 | 26506 | 158059 | 0.7040596 | 0.10111237 | 0.60294724 |
19 | 524288 | 368668 | 49925 | 318743 | 0.70317841 | 0.09522438 | 0.60795403 |
20 | 1048576 | 736700 | 94469 | 642231 | 0.70257187 | 0.09009266 | 0.61247921 |
21 | 2097152 | 1472182 | 179362 | 1292820 | 0.70199108 | 0.08552647 | 0.61646461 |
22 | 4194304 | 2942000 | 341031 | 2600969 | 0.70142746 | 0.08130813 | 0.62011933 |
23 | 8388608 | 5880300 | 650401 | 5229899 | 0.70098639 | 0.07753384 | 0.62345254 |
24 | 16777216 | 11754418 | 1242153 | 10512265 | 0.70061791 | 0.07403809 | 0.62657982 |