Course of Raku / Addendum 🆕 / Working with data / Numbers and mathematics / Exercises
Prime factorisation
Problem
Break the number 360 into its prime factors and print
them as a list, with repeated factors shown as many times as they occur
(so 12 would be 2 2 3).
Example
The program prints:
[2 2 2 3 3 5]Solution
Course navigation
← Solution: Perfect numbers | Solution: Prime factorisation →