object Lychrel
{
def lychrel(a: Int): Boolean = {
var t: BigInt = a
for (i <- 1 until 50) {
t = t + BigInt(t.toString.reverse)
if (t.toString == t.toString.reverse)
return false
}
true
}
def main(args: Array[String]) = {
var cnt = 0
for (i <- 1 until 10000)
if (lychrel(i)) cnt = cnt + 1
println(cnt)
}
}