Category talk:Wren-i64: Difference between revisions

→‎Source code (Wren): Replaced U64.digitSum with a more efficient version.
(→‎Source code (Wren): Added largestPrime and prev{rime)
(→‎Source code (Wren): Replaced U64.digitSum with a more efficient version.)
Line 1,112:
return 0
}
// Return a list of the current instance's base 10 digits
digits { toString.map { |d| Num.fromString(d) }.toList }
 
digits { toString.map { |d| Num.fromString(d) }.toList } // aReturns listthe sum of the current instance's base 10 digits.
digitSum {
digitSum { digits.reduce(0) { |acc, d| acc = acc + d } } // the sum of those digits
var sum = 0
for (d in toString.bytes) sum = sum + d - 48
return sum
}
}
 
9,476

edits