for input in 4,18,22,13,666,-265,0,1,4937775: n=m=input s=0 for d in range(2,n): while n%d<1:n/=d;s+=sum(map(int,`d`)) print input,":",n<m>s==sum(map(int,`m`))
Standard input is empty
4 : False 18 : False 22 : True 13 : False 666 : True -265 : False 0 : False 1 : False 4937775 : True