23 lines
No EOL
443 B
Python
23 lines
No EOL
443 B
Python
import sys
|
|
|
|
data = sys.stdin.read().split()
|
|
n = int(data[0])
|
|
factors = []
|
|
d = 2
|
|
while d * d <= n:
|
|
if n % d == 0:
|
|
count = 0
|
|
while n % d == 0:
|
|
count += 1
|
|
n //= d
|
|
factors.append((d, count))
|
|
d += 1
|
|
if n > 1:
|
|
factors.append((n, 1))
|
|
ans_parts = []
|
|
for p, e in factors:
|
|
if e > 1:
|
|
ans_parts.append(f"{p}^{e}")
|
|
else:
|
|
ans_parts.append(f"{p}")
|
|
print("*".join(ans_parts)) |