Sequence: smallest number with exactly n divisors: Difference between revisions
Sequence: smallest number with exactly n divisors (view source)
Revision as of 21:48, 19 July 2020
, 3 years agoSwift: removed unnecessary variable, renamed another one
(Added Wren) |
m (Swift: removed unnecessary variable, renamed another one) |
||
Line 1,387:
var n = number
var total = 1
// Deal with powers of 2 first
while n % 2 == 0 {
total += 1
n /= 2
}
Line 1,397 ⟶ 1,395:
var p = 3
while p * p <= n {
var
while n % p == 0 {
n /= p
}
total *=
p += 2
}
|