Jump to content

Prime numbers whose neighboring pairs are tetraprimes: Difference between revisions

→‎{{header|Wren}}: More efficient as we need to sort the gaps anyway to find the median.
(Added XPL0 example.)
(→‎{{header|Wren}}: More efficient as we need to sort the gaps anyway to find the median.)
Line 90:
var gaps = List.filled(tetras.count-1, 0)
for (k in 0...tetras.count-1) gaps[k] = tetras[k+1] - tetras[k]
var min = Numsgaps.minsort(gaps)
var maxmin = Nums.max(gaps)[0]
var medmax = Nums.median(gaps.sort())[-1]
var med = Nums.median(gaps)
Fmt.print("Minimum gap between those $,d primes : $,d", c, min)
Fmt.print("AverageMedian gap between those $,d primes : $,d", c, avg)
Fmt.print("Maximum gap between those $,d primes : $,d", c, max)
Fmt.print()
9,485

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.