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-80x+719
f(0)=719
f(1)=5
f(2)=563
f(3)=61
f(4)=83
f(5)=43
f(6)=11
f(7)=13
f(8)=1
f(9)=1
f(10)=19
f(11)=1
f(12)=97
f(13)=1
f(14)=41
f(15)=1
f(16)=1
f(17)=1
f(18)=397
f(19)=1
f(20)=37
f(21)=1
f(22)=557
f(23)=1
f(24)=1
f(25)=1
f(26)=137
f(27)=89
f(28)=67
f(29)=1
f(30)=71
f(31)=1
f(32)=1
f(33)=1
f(34)=1
f(35)=107
f(36)=173
f(37)=109
f(38)=877
f(39)=1
f(40)=881
f(41)=1
f(42)=1
f(43)=1
f(44)=1
f(45)=1
f(46)=1
f(47)=1
f(48)=1
f(49)=1
f(50)=1
f(51)=1
f(52)=1
f(53)=1
f(54)=1
f(55)=1
f(56)=1
f(57)=1
f(58)=1
f(59)=1
f(60)=1
f(61)=1
f(62)=1
f(63)=1
f(64)=1
f(65)=1
f(66)=1
f(67)=1
f(68)=1
f(69)=1
f(70)=1
f(71)=1
f(72)=1
f(73)=1
f(74)=1
f(75)=1
f(76)=1
f(77)=1
f(78)=1
f(79)=1
f(80)=1
f(81)=1
f(82)=883
f(83)=1
f(84)=211
f(85)=1
f(86)=1
f(87)=1
f(88)=1423
f(89)=1
f(90)=1619
f(91)=1
f(92)=1823
f(93)=241
f(94)=1
f(95)=1
f(96)=1
f(97)=1
f(98)=191
f(99)=1
b) Substitution of the polynom
The polynom f(x)=x^2-80x+719 could be written as f(y)= y^2-881 with x=y+40
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-40
f'(x)>2x-81 with x > 30
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 | 2 | 1 | 1.5 | 1 | 0.5 |
2 | 4 | 5 | 2 | 3 | 1.25 | 0.5 | 0.75 |
3 | 8 | 8 | 2 | 6 | 1 | 0.25 | 0.75 |
4 | 16 | 11 | 4 | 7 | 0.6875 | 0.25 | 0.4375 |
5 | 32 | 18 | 6 | 12 | 0.5625 | 0.1875 | 0.375 |
6 | 64 | 23 | 8 | 15 | 0.359375 | 0.125 | 0.234375 |
7 | 128 | 46 | 18 | 28 | 0.359375 | 0.140625 | 0.21875 |
8 | 256 | 119 | 29 | 90 | 0.46484375 | 0.11328125 | 0.3515625 |
9 | 512 | 278 | 55 | 223 | 0.54296875 | 0.10742188 | 0.43554688 |
10 | 1024 | 594 | 101 | 493 | 0.58007813 | 0.09863281 | 0.48144531 |
11 | 2048 | 1229 | 191 | 1038 | 0.60009766 | 0.09326172 | 0.50683594 |
12 | 4096 | 2545 | 342 | 2203 | 0.62133789 | 0.08349609 | 0.5378418 |
13 | 8192 | 5160 | 627 | 4533 | 0.62988281 | 0.07653809 | 0.55334473 |
14 | 16384 | 10411 | 1170 | 9241 | 0.63543701 | 0.07141113 | 0.56402588 |
15 | 32768 | 20968 | 2162 | 18806 | 0.63989258 | 0.065979 | 0.57391357 |
16 | 65536 | 42238 | 3971 | 38267 | 0.64450073 | 0.06059265 | 0.58390808 |
17 | 131072 | 85036 | 7434 | 77602 | 0.64877319 | 0.05671692 | 0.59205627 |
18 | 262144 | 170729 | 13910 | 156819 | 0.65127945 | 0.05306244 | 0.59821701 |
19 | 524288 | 342772 | 26220 | 316552 | 0.65378571 | 0.05001068 | 0.60377502 |
20 | 1048576 | 687716 | 49606 | 638110 | 0.65585709 | 0.04730797 | 0.60854912 |
21 | 2097152 | 1379302 | 94114 | 1285188 | 0.65770245 | 0.04487705 | 0.61282539 |
22 | 4194304 | 2765227 | 179425 | 2585802 | 0.65928149 | 0.04277825 | 0.61650324 |
23 | 8388608 | 5542939 | 341842 | 5201097 | 0.66076982 | 0.04075074 | 0.62001908 |
24 | 16777216 | 11109515 | 652166 | 10457349 | 0.6621787 | 0.03887212 | 0.62330657 |