Skip to content

Instantly share code, notes, and snippets.

@tanob
Created August 13, 2010 05:44
Show Gist options
  • Save tanob/522371 to your computer and use it in GitHub Desktop.
Save tanob/522371 to your computer and use it in GitHub Desktop.
Determines if a number is happy
import Data.Char;h 1 _=1;h x m|any(==x)m=0;h x m=h(sum$map((^2).digitToInt)$show x)(x:m);main=print$h 7 []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment