August 27, 2024

P35 - Determine the prime factors of a given positive integer. 

Construct a flat list containing the prime factors in ascending order.

scala

scala> 315.primeFactors
res0: List[Int] = List(3, 3, 5, 7)
Be first to comment
Leave a reply