class Solution(object):
def integerBreak(self, n):
"""
:type n: int
:rtype: int
"""
ret = 1
i = 2
while n / i >= 2:
tmp = 0
if n % i == 0:
tmp = i ** (n / i)
else:
tmp = i ** (n / i  1) * (n % i + i)
ret = tmp if ret < tmp else ret
i += 1
return ret
What's wrong with my code? I run well in my computer

Seems like you messed up with the logic. Basically, you are iterating the number thru division factors, and 4=2+2, 10=4(2+2)+3+3, 12=3+3+3+3... happen to follow such pattern.
However, the breakthru of this problem is not division factor but dividing 3.
If n%3=1: then ret=3^(k1)*4 If n%3=2: then ret=3^k*2 If n%3=0: then ret=3^k, where k=n/3