Category talk:Wren-math: Difference between revisions

→‎Source code: Added squareFree, cubeFree and powerFree methods to Int class.
(→‎Source code: Added Int.getPrime method.)
(→‎Source code: Added squareFree, cubeFree and powerFree methods to Int class.)
 
Line 760:
return res
}
 
// Returns true if the prime factorization of 'n' does not contain any
// factors which are repeated 'm' (or more) times, or false otherwise.
static powerFree(m, n) { Int.primePowers(n).all { |pp| pp[1] < m } }
 
// Covenience versions of above method for squares and cubes.
static squareFree(n) { powerFree(2, n) }
static cubeFree(n) { powerFree(3, n) }
 
// Returns all the divisors of 'n' including 1 and 'n' itself.
9,476

edits