Menu Close

Highest factor in addition

8=2+2+2+2= multiplying gives = 16
highest factor in addition.

4= 2+2 = multiply = 4

9 = 3+3+3 = multiply = 27
its greater common factor

Input:
Enter any number : 9

Output:
27A
Const=int(input('Enter any number : '))
L=[]
for i in range(2,Const):
    temp=1
    if Const%i==0:
        Q=int(Const/i)
        for j in range(Q):
            temp*=i
        L.append(temp)
    else:
        R=Const%i
        Q=int(Const/i)
        for j in range(Q):
            temp*=i
        temp*=R
        L.append(temp)
print(max(L))

Input_1:
Enter any number : 8

Output:
18


Input_2:
Enter any number : 4

Output:

4


Input_3:
Enter any number : 6

Output:
9


executed using python3 linux terminal

More Q