main=mapM print[x|x<-[999..9999],r<-[1..9],sum[read[c]|c<-show x]^r==x]
Standard input is empty
2401 4913 5832
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!