Created
April 18, 2015 12:06
-
-
Save kirushik/5e79fcd6e2c965f20fa9 to your computer and use it in GitHub Desktop.
Binary palindromes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Palindrome do | |
def is_palindrome(x) do | |
y = x |> Integer.to_char_list(2) | |
y == Enum.reverse y | |
end | |
end | |
1900..2100 |> Enum.filter &Palindrome.is_palindrome/1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment