import math
var = int(input("Enter the number: "))
fac = math.factorial(var)
def prime(x):
for i in range(3,x-1,2):
if x%i == 0:
return False
return True
def decomp(x,fac):
for i in range(fac):
if fac % x**i != 0:
return i-1
print('2^' + str(decomp(2,fac)), end='')
for i in range(3,var+1,2):
if prime(i) == True:
e = decomp(i,fac)
if e != 1:
print(' * ' + str(i) + '^' + str(e), end='')
else:
print(' * ' + str(i), end='')
else:
continue
print('\n')
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python