Computer Science, asked by selvi143, 8 months ago

For a given integer N, find the number of minimum elements the N has to be broken into such that their product is maximum. Input User Task: Since this will be a functional problem, you don't have to take input. You just have to complete the function MaximumProduct() that takes integer N as parameter. Constraints:- 1 <= N <= 10000 Output Return the minimum number of elements the N has to be broken into

Answers

Answered by tabassumperween390
0

Answer : Breaking an Integer to get Maximum Product

Last Updated: 27-09-2020

Given an number n, the task is to broken in such a way that multiplication of its parts is maximized.

Input : n = 10

Output : 36

10 = 4 + 3 + 3 and 4 * 3 * 3 = 36

is maximum possible product.

Input : n = 8

Output : 18

8 = 2 + 3 + 3 and 2 * 3 * 3 = 18

is maximum possible product.

Mathematically, we are given n and we need to maximize a1 * a2 * a3 …. * aK such that n = a1 + a2 + a3 … + aK and a1, a2, … ak > 0.

Note that we need to break given Integer in at least two parts in this problem for maximizing the product.

Answered by ashutoshmishra3065
0

Answer:

Explanation:

Integer definition:

An integer is a whole number that can be positive, negative, or zero and is not a fraction.

Product definition:

The outcome of multiplication or an expression that specifies factors to be multiplied is a product. For instance, the product of 6 and 5 is 30, and the product of  x and  (2+x)  is x .(2+x) (indicating that the two factors should be multiplied together).

Breaking an integer to get maximum product:

The assignment must be divided in a way that maximizes the multiplication of its parts, given a number n.

Input: n=10

Output: 36

10 = 4 + 3 + 3 

The greatest feasible product is 4\times  3 \times 3 = 36

Data: n = 8

Output: 18

8 = 2 + 3 + 3

The greatest feasible product is 2 \times 3 \times 3 = 36

Assuming that n = a1 + a2 + a3... + aK and that a1, a2,... ak &gt; 0, we must mathematically maximize a1 \times a2 \times a3.... \times  aK.

Keep in mind that in order to maximize the product in this issue, we must divide the provided integer into at least two pieces.

#SPJ2

Similar questions