Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -0,0 +1,49 @@
|
|||
Type PrimeGaps
|
||||
As Ulong lastPrime
|
||||
As Ulongint gapStarts(1 To 1e7)
|
||||
End Type
|
||||
|
||||
Function NextPrime(n As Ulong) As Ulong
|
||||
Dim As Ulong j, i = n + 1
|
||||
Do
|
||||
For j = 2 To Sqr(i)
|
||||
If i Mod j = 0 Then Exit For
|
||||
Next j
|
||||
If j > Sqr(i) Then Return i
|
||||
i += 1
|
||||
Loop
|
||||
End Function
|
||||
|
||||
Function findGapStart(Byref pg As PrimeGaps, gap As Ulongint) As Ulongint
|
||||
Dim As Ulongint prev, diff
|
||||
If pg.gapStarts(gap) <> 0 Then Return pg.gapStarts(gap)
|
||||
Do
|
||||
prev = pg.lastPrime
|
||||
pg.lastPrime = NextPrime(pg.lastPrime)
|
||||
diff = pg.lastPrime - prev
|
||||
pg.gapStarts(diff) = prev
|
||||
If gap = diff Then Return prev
|
||||
Loop
|
||||
End Function
|
||||
|
||||
Dim Shared As PrimeGaps pg
|
||||
pg.lastPrime = NextPrime(2)
|
||||
Dim As Ulongint limit = 1e7
|
||||
Dim As Integer pm = 10
|
||||
Dim As Ulongint start1, start2, gap1 = 2, gap2, diff
|
||||
Do
|
||||
start1 = findGapStart(pg, gap1)
|
||||
gap2 = gap1 + 2
|
||||
start2 = findGapStart(pg, gap2)
|
||||
diff = Abs(start2 - start1)
|
||||
If diff > pm Then
|
||||
Print "Earliest difference >"; pm; " between adjacent prime gap starting primes:"
|
||||
Print "Gap "; gap1; " starts at "; start1; ", gap "; gap2; " starts at "; start2; ", difference is "; diff; !".\n"
|
||||
If pm = limit Then Exit Do
|
||||
pm *= 10
|
||||
Else
|
||||
gap1 = gap2
|
||||
End If
|
||||
Loop
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue