diff --git a/snippets/python/s/prime-factors.md b/snippets/python/s/prime-factors.md index ead80e52f..4d0a977f2 100644 --- a/snippets/python/s/prime-factors.md +++ b/snippets/python/s/prime-factors.md @@ -3,14 +3,14 @@ title: Prime factors of number type: snippet language: python tags: [math,algorithm] -cover: dark-leaves-3 -dateModified: 2023-05-24T00:00:00.000Z +cover: river-flow +dateModified: 2023-05-24T05:00:00+02:00 --- -Find and return the list containing prime factors of a number. +Finds and returns the list of prime factors of a number. - Use a `while` loop to iterate over all possible prime factors, starting with `2`. -- If the current `factor`, exactly divides `num`, add `factor` to the `factors` list and divide `num` by `factor`. Otherwise, increment `factor` by one. +- If the current `factor` exactly divides `num`, add `factor` to the `factors` list and divide `num` by `factor`. Otherwise, increment `factor` by one. ```py def prime_factors(num): @@ -28,4 +28,4 @@ def prime_factors(num): ```py prime_factors(12) # [2,2,3] prime_factors(42) # [2,3,7] -``` \ No newline at end of file +```