CalmoSoft primes: Difference between revisions

m
→‎{{header|Wren}}: Now uses new 'Fmt.va' method to abridge lists.
m (→‎{{header|Wren}}: Now uses new 'Fmt.va' method to abridge lists.)
Line 879:
for (i in 0...pc) {
if (pc - i < longest) break
sum =if (i > 0) ?sum = sum - primes[i-1] : sum
var sum2 = sum
for (j in pc-1..i) {
var temp = j - i + 1
if (temp < longest) break
sum2 =if (j < pc -1) ?sum2 = sum2 - primes[j+1] : sum2
if (Int.isPrime(sum2)) {
if (temp > longest) {
Line 912:
Fmt.print("having a length of $,d is/are:\n", longest)
for (i in 0...sIndices.count) {
var cp1cp = primes[sIndices[i]..sIndiceseIndices[i]+5]
var cp2cps = primes[eIndices[i]-5Fmt.va("d", 1, cp, 0, " + ", "", "", 6, "..eIndices[i]]")
var cps = cp1.join(" + ") + " + .. + " + cp2.join(" + ")
Fmt.print("$s = $,d", cps, sums[i])
}
9,488

edits