Haskell,60个字节
([n^2|n<-[1..],elem(show n)$words=<<mapM(:" ")(show$n^2)]!!)
在线尝试!
n<-[1..] -- loop n through all numbers starting with 1
[n^2| , ] -- collect the n^2 in a list where
elem(show n) -- the string representation of 'n' is in the list
words ... (show$n^2) -- which is constructed as follows:
show$n^2 -- turn n^2 into a string, i.e. a list of characters
(:" ") -- a point free functions that appends a space
-- to a character, e.g. (:" ") '1' -> "1 "
mapM -- replace each char 'c' in the string (n^2) with
-- each char from (:" ") c and make a list of all
-- combinations thereof.
-- e.g. mapM (:" ") "123" -> ["123","12 ","1 3","1 "," 23"," 2 "," 3"," "]
words=<< -- split each element into words and flatten to a single list
-- example above -> ["123","12","1","3","1","23","2","3"]
( !!) -- pick the element at the given index