Sha256: 6e3f3cfb0321299736b92f38ff8bb352e2895f37471b0555e5c502ba09766000
Contents?: true
Size: 548 Bytes
Versions: 396
Compression:
Stored size: 548 Bytes
Contents
struct PrimeFactors { var number: Int64 var toArray = [Int64]() private func primesFor( _ number: Int64) -> [Int64] { var number = number var primes = [Int64]() var divisor: Int64 = 2 while number > 1 { while number % divisor == 0 { primes.append(divisor) number /= divisor } divisor += 1 } return primes } init(_ value: Int64) { self.number = value self.toArray = primesFor(value) } }
Version data entries
396 entries across 396 versions & 1 rubygems