开发者

Integer to its prime factors [closed]

开发者 https://www.devze.com 2023-02-23 06:11 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetor开发者_如何学Goical andcannot be reasonably answered in its current form.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetor开发者_如何学Goical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago.

hey i need to desing a program that inputs an integer and outputs the prime factors of the integer example 660 input n output is 2 2 3 5 11


Break the problem down. Firstly, you need a list of every prime number smaller than the square root of the input. You can obtain this list slowly through trial division, or quickly by using something like Eratosthenes' Sieve - implement that, and you're halfway there. Everything else should fall into place.

0

精彩评论

暂无评论...
验证码 换一张
取 消