Skip to content

Instantly share code, notes, and snippets.

@nwjlyons
Last active August 17, 2020 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwjlyons/af444650813127ac9e6b04ada1dd523c to your computer and use it in GitHub Desktop.
Save nwjlyons/af444650813127ac9e6b04ada1dd523c to your computer and use it in GitHub Desktop.
Taking the square root of each number from 1 to 100, which of them are irrational
Enum.reject 1..100, fn i ->
square_root = Decimal.sqrt(i)
remainder = Decimal.rem(square_root, 1)
Decimal.eq?(remainder, 0)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment