Math, asked by jemjames623, 7 months ago

9.
Find all the factors of 60 by expressing it as a product of its prime factors in the exponential fom:
Prime factorisation
.. 60 = 2
Х
x 5
....
11
21 60
2
Possible combinations:
1,
, 22, 3,
Х
3 x 5
5
2 x 3, 22
2² x
......... X 5, 22 x
2 x 3 x 5 , 22 x
... X
.....
Thus, all factors of 60 are: 1, 2,
.....,10, 12, .......,
30 and 60.
.............
30​

Answers

Answered by shivtanu21
1

25 thanks + follow = inbox

Answered by vihu14
1

Answer:

Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output should be “2 2 3”. And if the input number is 315, then output should be “3 3 5 7”.

Recommended: Please solve it on “PRACTICE ” first, before moving on to the solution.

Following are the steps to find all prime factors.

1) While n is divisible by 2, print 2 and divide n by 2.

2) After step 1, n must be odd. Now start a loop from i = 3 to square root of n. While i divides n, print i and divide n by i. After i fails to divide n, increment i by 2 and continue.

3) If n is a prime number and is greater than 2, then n will not become 1 by above two steps. So print n if it is greater than 2.

Similar questions