===== Julia =====
function euler()
x = floor(Int, sqrt(19293949596979899.0))
while !check(x)
x -= 1
end
return x*10
end
function check(x)
str = string(x*x)
if length(str) != 17
return false
end
d1,_,d2,_,d3,_,d4,_,d5,_,d6,_,d7,_,d8,_,d9 = str
return d1 == '1' && d2 == '2' && d3 == '3' &&
d4 == '4' && d5 == '5' && d6 == '6' &&
d7 == '7' && d8 == '8' && d9 == '9'
end
println(euler())
===== Haskell =====
main = putStrLn (show euler)
euler =
search (floor (sqrt 19293949596979899))
search x
| check (show (x * x)) = (x * 10)
| otherwise = search (x - 1)
check ['1',_,'2',_,'3',_,'4',_,'5',_,'6',_,'7',_,'8',_,'9'] = True
check _ = False
===== Picat =====
main =>
Start = floor(sqrt(19293949596979899)),
between(-Start, 0, X),
to_string(X*X) = ['1',_,'2',_,'3',_,'4',_,'5',_,'6',_,'7',_,'8',_,'9'],
println(-X*10).