And now that I have learned a simpler break condition for the problem, it is easier:
f::Int->Intf=sum-- Sum up the squares.map((^2)-- Compute squares.read-- Convert digits to Ints.(:[]))-- Explode number string to list of digit strings.show-- Convert input number to stringisHappy::Int->BoolisHappyn|n==4=False|n==1=True|otherwise=isHappy(fn)main=print$filterisHappy[1..200]
On the other hand, I like the possibility of my original code to see the list of intermediate results to get a feeling for the problem.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
And now that I have learned a simpler break condition for the problem, it is easier:
On the other hand, I like the possibility of my original code to see the list of intermediate results to get a feeling for the problem.