Problem:


Prime Factorization

Factorize a given integer n.

Input

n

An integer n is given in a line.

Output

Print the given integer n and :. Then, print prime factors in ascending order. If n is divisible by a prime factor several times, the prime factor should be printed according to the number of times. Print a space before each prime factor.

Constraints

2 ≤ n ≤ 109

Sample Input 1

12

Sample Output 1

12: 2 2 3

Sample Input 2

126

Sample Output 2

126: 2 3 3 7



Sample input:
12


Sample output:
12: 2 2 3

Submission status: Accepted

Solution code:
import math

def Eratos(n):
	if n==2:
		return [2]
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []
	top = 1
	while top < math.sqrt(n) and math.sqrt(n)>=2:
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n=int(input())
test=n
p=Eratos(math.ceil(math.sqrt(test)))
fac=[]
next_flag=True
while test!=1 and len(p)!=0:
	if next_flag:
		ch=p.pop(0)
		next_flag=False
	if test%ch==0:
		while test%ch==0:
			fac.append(ch)
			test//=ch
	next_flag=True
if test!=1:
	fac.append(test)
print("%d: " % n,end='')
for i in range(len(fac)):
	if i!=len(fac)-1:
		print(fac[i],end=' ')
	else:
		print(fac[i])

Submission status: Accepted

Solution code:
n = int(input())
num = n

fct = []
b = 2
while b * b <= n:
    while n % b == 0:
        n //= b
        fct.append(b)
    b += 1
if n > 1:
    fct.append(n)

print(str(num) + ": " + ' '.join(str(f) for f in fct))

Submission status: Accepted

Solution code:
n=int(input())
n2=str(n)
def factorint(N):
    i=2
    fct=[]
    while i**2<=N:
        if N%i!=0:
            i+=1
        else:
            N//=i
            fct.append(i)
    if N>1:
        fct.append(N)
    return fct

print(n2+":"," ".join(map(str,factorint(n))))

Submission status: Accepted

Solution code:
import math
from typing import List


def calc_divisors(n):
    divisors = [1, n]

    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n // i)

    return sorted(divisors)


def prime_factorize(n: int) ->List[int]:
    prime_factors = []
    divisors = calc_divisors(n)[1:]

    for i in divisors:
        while True:
            div, mod = divmod(n, i)
            if mod == 0:
                prime_factors.append(i)
                n = div
            else:
                break
        if n == 1:
            break
    return prime_factors


def main():
    n = int(input())
    prime_factors = prime_factorize(n)
    print("{}: {}".format(n, ' '.join(map(str, prime_factors))))


main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 23:01:57 2018

@author: maezawa
"""

n = int(input())
sqn = int(n**0.5)+1

is_prime = [True]*(sqn+1)

is_prime[0] = False
is_prime[1] = False

for i in range(2, sqn//2):
    if is_prime[i] == True:
        for j in range(2*i,sqn+1,i):
            is_prime[j] = False

prime_numbers = [i for i in range(sqn+1) if is_prime[i]]

nn = n
ans = []
for p in prime_numbers:
    while nn % p == 0:
        nn = nn // p
        ans.append(p)
if nn != 1:
    ans.append(nn)
print('{}: '.format(n), end = '')
print(*ans)

Submission status: Accepted

Solution code:
import math
a=int(input())
b=int(math.sqrt(a))+1

print(str(a)+":",end="")
for i in range(2,b):
    while a%i==0:
        print(" "+str(i),end="")
        a=a//i
if a!=0 and a!=1:
    print(" "+str(a),end="")
print()

Submission status: Accepted

Solution code:
import math

n = int(input())

soinsu = []

c = n
if (c % 2 == 0):
    while True:
        soinsu.append(2)
        c = c // 2
        if ( c % 2 != 0):
            break

len = int(math.sqrt(c)) + 1
for i  in range (3,len,2):
    while True:
        if ( c % i != 0):
            break
        soinsu.append(i)
        c = c // i
    if ( c == 1):
        break
if ( c != 1):
    soinsu.append(c)

print (n,":",sep="",end="")
for i in soinsu:
    print (' {}'.format(i),sep="",end="")
print("")

Submission status: Accepted

Solution code:
import math
n = int(input())
num  = [str(n)+":"]
i = 2
while i <= math.sqrt(n):
    while n % i == 0:
        num.append(str(i))
        n//=i
    i+=1
if n != 1:
    num.append(str(n))
print(num[0]+" "+str(n) if len(num) == 1 else " ".join(num))

Submission status: Accepted

Solution code:
N = int(input())


def prime_factorization(n):
    table = []
    for x in range(2, int(n**0.5)+2):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


print("{}:".format(N), *prime_factorization(N))

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
k = int(sqrt(n))
Primes = [False,False]
for i in range(k + 2):
    Primes.append(True)
for i in range(2, k + 1):
    if Primes[i]:
        j = 2 * i
        while j < k + 1:
            Primes[j] = False
            j += i
primes = [i for i in range(k + 1) if Primes[i]]
del(Primes)
ans = []
index = 0
tmp = n
while n > 1 and len(primes) > index:
    if n % primes[index] == 0:
        n /= primes[index]
        ans.append(str(primes[index]))
    else:
        index += 1
if n != 1:
    ans.append(str(int(n)))
print(str(tmp) + ": " + " ".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
print('{}:'.format(n), end='')
i = 2
while i <= int(n ** .5):
    if n % i == 0:
        n //= i
        print('', i, end='')
    else:
        i += 1
if n != 1:
    print('', n)

Submission status: Accepted

Solution code:
import math

def primeFactors(n):
	result = list()
	while n % 2 == 0:
		result.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			result.append(i)
			n = n / i
	if n > 2:
		result.append(n)
	return sorted(result)

n = int(input())
print('%d:' % (n), end='')
result = primeFactors(n)
for i in range(len(result)):
	print(' %d' % (result[i]), end='' if i < len(result) - 1 else '\n')

Submission status: Accepted

Solution code:
def smallest_factor(integer):
    j = 2
    while j :
        if j ** 2 > integer:
            return integer
        elif integer % j == 0:
            return j
        else:
            j += 1

n = int(input())
start = str(n)
prime_factors = []
while n >= 2:
    prime_factors.append(str(smallest_factor(n)))
    n //= smallest_factor(n)

print(start +  ': '+ ' '.join(prime_factors))

Submission status: Runtime Error

Solution code:
def fact(num):
  ret=[]
  if num==2:
    ret=[2]
    return ret
  elif num==3:
    ret=[2,3]
    return ret
  while 1:
    for i in range(2,int(num**0.5)+1):
      if num%i==0:
        ret.append(i)
        num=num%i
        break

n=int(input())
ans=fact(n)
print('{}: {}'.format(n,' '.join(map(str,ans)))

Submission status: Runtime Error

Solution code:
def fact(num):
  ret=[]
  if num==2:
    ret=[2]
    return ret
  elif num==3:
    ret=[2,3]
    return ret
  while 1:
    for i in range(2,int(num**0.5)+1):
      if num%i==0:
        ret.append(i)
        num=num%i
        break
    else:
      break
  
n=int(input())
ans=fact(n)
print('{}: {}'.format(n,' '.join(map(str,ans))))

Submission status: Runtime Error

Solution code:
n = input()
l = []
l += [str(n) + ":"]
while 1:
    if n == 1:break
    for i in count(2):
        if n % i == 0:
            n /= i
            l += [i]
            break
print " ".join(map(str,l))

Submission status: Runtime Error

Solution code:
def factorize(n):
    p = n
    while True:
        if p % 2 == 0:
            p //= 2
            yield 2
        else:
            break

    r = 3
    while p != 1:
        if p % i == 0:
            p //= i
            yield i
        else:
            r += 2

n = int(input())
l = factorize(n)

print(str(n)+":",*list(l))

Submission status: Runtime Error

Solution code:
import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {

  def factorize(p:Int,d:Int,l:List[Int]):List[Int] = {
    if(d >= Math.sqrt(p)+1) {
      if(p != 1) p::l else l
    } else {
      if(p%d == 0)
        factorize(p,d,d::l)
      else if(d==2)
        factorize(p,d+1,l)
      else
        factorize(p,d+2,l)
    }
  }

  def printList(l:List[Int]):Unit = l match {
    case List() => ()
    case h::tail =>
        print(" " + h)
        printList(tail)
  }

  def main(args: Array[String]) = {
    val n = readInt
    val list = factorize(n,2,List())
    print(n.toString + ":")
    printList(list)
    println()
  }
}

Submission status: Runtime Error

Solution code:
while True:
    n,x = map(int,input().split())

    if n==0 and x==0: 
        break

    print( sum( len( range(max(i+1,x-i-n),min(n,(x-i+1)//2)) ) ) for i in range(1,min(n-1,x//3)) )

Submission status: Runtime Error

Solution code:
while True:
    n,x = map(int,input().split())

    if n==0 and x==0:
        break

    print(sum( [ len(range(max(i+1,x-i-n),min(n,(x-i+1)//2))) for i in range(1,min(n-1,x//3)) ]))

Submission status: Runtime Error

Solution code:
def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False
    i = 3
    xx = int(pow(x, 0.5))
    while i <= xx:
        if x % i == 0:
            return False
        i += 2
    return True

n = int(input())
rx = int(pow(n, 0.5))
l = rx+1
ps = []
for i in range(n):
    if isPrime(i):
        ps.append(i)
    if i == l:
        break
ans = []
i = 0
nn = n
while n != 1:
    if n % ps[i] == 0:
        n //= ps[i]
        ans.append(ps[i])
    else:
        i += 1
print(str(nn)+":", ' '.join(map(str, ans)))

Submission status: Runtime Error

Solution code:
def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False
    i = 3
    xx = int(pow(x, 0.5))
    while i <= xx:
        if x % i == 0:
            return False
        i += 2
    return True

n = int(input())
rx = int(pow(n, 0.5))
l = rx+1
ps = []
for i in range(n):
    if isPrime(i):
        ps.append(i)
    if i == l:
        break
ans = []
i = 0
nn = n
ps.append(nn)
while n != 1:
    if n % ps[i] == 0:
        n //= ps[i]
        ans.append(ps[i])
    else:
        i += 1
print(str(nn)+":", ' '.join(map(str, ans)))

Submission status: Runtime Error

Solution code:
def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False
    i = 3
    xx = int(pow(x, 0.5))
    while i <= xx:
        if x % i == 0:
            return False
        i += 2
    return True

n = int(input())
rx = int(pow(n, 0.5))
l = rx+1
ps = []
for i in range(n):
    if isPrime(i):
        ps.append(i)
ans = []
i = 0
nn = n
while n != 1:
    if n % ps[i] == 0:
        n //= ps[i]
        ans.append(ps[i])
    else:
        i += 1
print(str(nn)+":", ' '.join(map(str, ans)))

Submission status: Runtime Error

Solution code:
p=lambda x:print(x,end=' ')
n=input():p(n+':')
n=int(n);s=n**.5
while n%2==0 and n>3:p(2);n//=2
d=3
while s>d and n>d:
 if n%d==0:p(d);n//=d
 else:d+=2
print(n)

Submission status: Runtime Error

Solution code:
p=lambda x:print(x,end=' ')
m=n=input();p(n+':')
n=int(n)
while n%2==0 and n>3:p(2);n//=2
d=3
while d*d<m and n>d:
 if n%d>0:d+=2
 else:p(d);n//=d
print(n)

Submission status: Runtime Error

Solution code:
def simple_prime_factrize(x):
    pfs = []
    for y in range(2, math.ceil(math.sqrt(x))):
        if x == 1: break
        while True:
            if x%y == 0:
                pfs.append(y)
                x = x/y
            else:
                break
    if len(pfs) == 0:
        pfs.append(x)
    return pfs
    
n = int(input())
print(str(n) + ': ' + ' '.join([str(x) for x in simple_prime_factrize(n)]))

Submission status: Runtime Error

Solution code:
import math

def make_primes(limit):
    n = 0
    primes = []
    for k in range(2, math.floor(math.sqrt(limit))+1):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            primes.append(k)
            primes.append(limit // k)

    primes.append(limit)
    return sorted(primes)


def main():
    n = int(input())
    original_n = n

    factors = []
    primes = make_primes(n)

    i = 0
    while True:
        if n == 1:
            break

        if n % primes[i] == 0:
            n //= primes[i]
            factors.append(primes[i])
        else:
            i += 1


    print("{}: {}".format(
        original_n,
        " ".join(list(map(str, factors)))
    ))



main()

Submission status: WA: Presentation Error

Solution code:

try:
    n = int(input())
except:
    exit

max_len = n 
work = [1 for i in range(0,max_len+1)]
prime = []
soinsu = []

for i in range(2,max_len+1):
    if (work[i] == 1 ):
        prime.append(i)
        j = i * 2
        while ( j <= max_len ):
            work[j] = 0
            j += i

t = n
while (t > 1):
    for i in prime:
        if (t % i == 0 ):           
            soinsu.append(i)
            t = t // i
soinsu.sort()
print (n,":",end ="")
for i in soinsu:
    print (" ",i, end ="")

Submission status: WA: Presentation Error

Solution code:

try:
    n = int(input())
except:
    exit

max_len = n 
work = [1 for i in range(0,max_len+1)]
prime = []
soinsu = []

for i in range(2,max_len+1):
    if (work[i] == 1 ):
        prime.append(i)
        j = i * 2
        while ( j <= max_len ):
            work[j] = 0
            j += i

t = n
while (t > 1):
    for i in prime:
        if (t % i == 0 ):           
            soinsu.append(i)
            t = t // i
soinsu.sort()
print (n,":",end ="",sep ="")
for i in soinsu:
    print (" ",i, end ="",sep="")

Submission status: WA: Presentation Error

Solution code:

try:
    n = int(input())
except:
    exit

max_len = n 
work = [1 for i in range(0,max_len+1)]
prime = []
soinsu = []

for i in range(2,max_len+1):
    if (work[i] == 1 ):
        prime.append(i)
        j = i * 2
        while ( j <= max_len ):
            work[j] = 0
            j += i

t = n
while (t > 1):
    for i in prime:
        if (t % i == 0 ):           
            soinsu.append(i)
            t = t // i
soinsu.sort()
print (n,":",end ="",sep ="")
for i in soinsu:
    print (" ",i, end ="",sep="")
print ("\n")

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
dict = {}
cnt = 0

for i in range(2, n):
    while n%i == 0:
        n = n/i
        cnt += 1
    dict[i] = cnt
    cnt = 0

print(str(N) + ': ', end='' )

for i in range(2, N):
    if i in dict:
        for j in range(dict[i]):
            print(i, end=' ')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
dict = {}
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    dict[i] = cnt
    cnt = 0

print(str(N) + ': ', end='' )

for i in range(2, N+1):
    if i in dict:
        for j in range(dict[i]):
            print(i, end=' ')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
mydict = {}
L = []
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    if cnt != 0:
        mydict[i] = cnt
    cnt = 0

#for i in range(2, N+1):
#    if i in mydict:
#        for j in range(mydict[i]):
#            L.append(i)

#print(str(N) + ': ' + ' '.join(map(str, L)))

print(str(N) + ':', end = '')

for i in range(2, N+1):
    if i in mydict:
        for j in range(mydict[i]):
            print(' ' + str(i), end='')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
mydict = {}
L = []
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    if cnt != 0:
        mydict[i] = cnt
    cnt = 0

print(str(N) + ':', end = '')

for i in range(2, N+1):
    if i in mydict:
        for j in range(mydict[i]):
            print(' ' + str(i), end='')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
mydict = {}
L = []
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    if cnt != 0:
        mydict[i] = cnt
    cnt = 0

#for i in range(2, N+1):
#    if i in mydict:
#        for j in range(mydict[i]):
#            L.append(i)

#print(str(N) + ': ' + ' '.join(map(str, L)))

print(str(N) + ':', end = '')

for i in range(2, N+1):
    if i in mydict:
        for j in range(mydict[i]):
            print(' ' + str(i), end='')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N

print(str(N) + ':', end = '')

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        print(' ' + str(i), end = '')

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
L = []

print(str(N) + ':', end = '')

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        print(' ' + str(i), end = '')
        if i == n+1:
            print('\n')

        #L.append(i)
        
#print(' '.join(map(str, L)))

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
L = []

print(str(N) + ':', end = '')

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        print(' ' + str(i), end = '')

print('\n')
        #L.append(i)
        
#print(' '.join(map(str, L)))

Submission status: WA: Presentation Error

Solution code:
N = int(input())
n = N
L = []

print(str(N) + ':', end = '')

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        print(' ' + str(i), end = '')

print('\n')

        #L.append(i)
        
#print(' '.join(map(str, L)))

Submission status: WA: Presentation Error

Solution code:
a=int(input())
n=a
i=2
fc=[]
while i*i<=a:
  while a%i==0:
    a//=i
    fc.append(i)
  i+=1
  if a>1:
    fc.append(a)
print(str(n)+":"+" ".join(str(b) for b in fc))

Submission status: WA: Presentation Error

Solution code:
import math
n = int(input())

def factorize_rec(n, factor):
    for i in range(2, math.floor(math.sqrt(n)) + 1):
        if n % i == 0:
            factor.append(i)
            return factorize_rec(n/i, factor)
    factor.append(int(n))
    return factor

def factorize(n):
    return factorize_rec(n, [])

print(str(n) +":", end=" ")
[print(i, end=" ") for i in factorize(n)]

Submission status: WA: Presentation Error

Solution code:
# -*- coding:utf-8 -*-

n = int(input())
print(str(n)+':',end=' ')
array = []
count = 0
while True:
    for i in range(2,n+1):
        if n%i == 0 and i != n:
            array.append(i)
            n = int(n/i)
            break
        if i == n:
            count += 1
            break
    if count == 15:
        break
array.append(n)
for i in range(len(array)):
    print(array[i],end=' ')
print('')

Submission status: WA: Presentation Error

Solution code:
# -*- coding:utf-8 -*-

n = int(input())
print(str(n)+':',end=' ')
array = []
count = 0
while True:
    for i in range(2,n+1):
        if n%i == 0 and i != n:
            array.append(i)
            n = int(n/i)
            break
        if i == n:
            count += 1
            break
    if count == 20:
        break
array.append(n)
for i in range(len(array)):
    print(array[i],end=' ')
print('')

Submission status: WA: Presentation Error

Solution code:
# -*- coding:utf-8 -*-
#Factorize a given integer n.

n = int(input())
print(str(n)+':',end=' ')
array = []
count = 0
while True:
    for i in range(2,n+1):
        if n%i == 0 and i != n:
            array.append(i)
            n = int(n/i)
            break
        if i == n:
            count += 1
            break
    if count == 15:
        break
array.append(n)
for i in range(len(array)):
    print(array[i],end='')

Submission status: WA: Presentation Error

Solution code:
# -*- coding:utf-8 -*-
#Factorize a given integer n.

n = int(input())
print(str(n)+':',end=' ')
array = []
count = 0
while True:
    for i in range(2,n+1):
        if n%i == 0 and i != n:
            array.append(i)
            n = int(n/i)
            break
        if i == n:
            count += 1
            break
    if count == 15:
        break
array.append(n)
for i in range(len(array)):
    print(array[i],end=' ')

Submission status: WA: Presentation Error

Solution code:
prime_number_table ={2:0}

for n in range(3,10000)[::2]:
    for k in prime_number_table:
        if n%k == 0:
            break
    else:
        prime_number_table[n] = 0 
        
n = int(input())
print("{0}:".format(n),end="")
for i in prime_number_table:
    if n == 1 or i > n:
        break
    while True:
        if n % i == 0:
            print(" {0}".format(i),end="")
            n /= i
        else:
            break

Submission status: WA: Presentation Error

Solution code:
n=int(input())
s=str(n)+" :"
b=True
d=n
i=2
while b:
 if d%i==0:
  d/=i
  s+=' '+str(i)
  i-=1
 b=i<d**0.5
 i+=1
if d!=1:s+=' '+str(d)
print(s)

Submission status: WA: Presentation Error

Solution code:
n_bk= n = int(input())
count_d = {}
factor_list = (2,3,4,5,6,7)

for factor in factor_list:

    while True:

        if n == factor:
            if str(factor) in count_d:
                count_d[str(factor)] = count_d[str(factor)] + 1
            else:
                count_d[str(factor)] = 1

            break

        if n % factor == 0:
            n = int(n / factor)
            if str(factor) in count_d:
                count_d[str(factor)] = count_d[str(factor)] + 1
            else:
                count_d[str(factor)] = 1
        else:
            break


#print(count_d)
print(str(n_bk)+':',end='')
for factor in factor_list:
    if str(factor) in count_d:
        for count in range(int(count_d[str(factor)])):
            print('',factor,end='')

Submission status: WA: Presentation Error

Solution code:
n = int(input())
m = n
ary = []
for i in range(2,n):
    while True:
        if n % i == 0:
            ary.append(i)
            n /= i
        else:
            break
    if n == 1:
        break
    
if len(ary) == 0:
    print("{}: {}".format(m,m),end="")
else:
    print("{}:".format(m),end="")
    for i in range(len(ary)):
        print(" {}".format(ary[i]),end="")
    print()

Submission status: WA: Presentation Error

Solution code:
p=lambda x:print(x,end=' ')
n=input()
p(n+':')
n=int(n)
while n%2==0 and n>3:
    p(2)
    n//=2
d=3
while n>d+1:
    if n%d==0:
        p(d)
        n//=d
    else:d+=2
p(n)

Submission status: WA: Presentation Error

Solution code:
s=0
I=input()
R=int(I)
print(I,end = ":")
i = 2
while True:
    if R % i == 0:
        R = R / i
        print(" " +str(i),end = "")
        if R == 1:
            break
    else:
        i += 1

Submission status: WA: Presentation Error

Solution code:
n=int(input())
print(str(n)+': ',end='')
x=[]
i=2
while n!=1:
    if n%i==0:
        n=n/i
        print(i,' ',end='')
    else:
        i+=1

Submission status: WA: Presentation Error

Solution code:
n=int(input())
print(str(n)+':',end='')
i=2
while n!=1:
    if n%i==0:
        n=n/i
        print(' '+str(i),end='')
    else:
        i+=1

Submission status: WA: Presentation Error

Solution code:
n=int(input())
print(n,':',sep='',end='')
i=2
while n!=1:
    if n%i==0:
        n=n/i
        print(' '+str(i),end='')
    else:
        i+=1

Submission status: WA: Presentation Error

Solution code:
n=int(input())
print(str(n),':',sep='',end='')
i=2
while n!=1:
    if n%i==0:
        n=n/i
        print(' '+str(i),end='')
    else:
        i+=1

Submission status: WA: Presentation Error

Solution code:
import math

s = "{0}: "
def prime_factorize(n):
	m = math.sqrt(n)+1
	i = 2
	prime = []
	while n != 1 and i < m:
		if n % i == 0:
			prime.append(i)
			n //= i
		else:
			i += 1
	return prime
n = int(input())
lst = prime_factorize(n)
print(s.format(n),end="")
for i in range(len(lst)):
	print(lst[i],end=" ")
print()