Skip to content

Instantly share code, notes, and snippets.

@rugyoga
Last active July 21, 2022 08:53
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 rugyoga/2d454fd14410063280f7844983a50da5 to your computer and use it in GitHub Desktop.
Save rugyoga/2d454fd14410063280f7844983a50da5 to your computer and use it in GitHub Desktop.
Find the 100th palindromic number that is divisible by 3
1
|> Stream.iterate(fn n -> n + 1 end)
|> Stream.filter(fn n -> s = Integer.to_string(n); s == String.reverse(s) end)
|> Stream.filter(fn n -> rem(n, 3) == 0 end)
|> Enum.at(99)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment