Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created January 12, 2012 22:14
Show Gist options
  • Select an option

  • Save timuruski/1603465 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1603465 to your computer and use it in GitHub Desktop.
Not surprising, but slightly fun math thing
x = 129
a = (0...x).map { |n| (n % x) }.uniq
puts a.size == x # true
x = 129
a = (0...(x-1)).map { |n| (n % x) }.uniq
puts a.size == x # false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment