Skip to content

Instantly share code, notes, and snippets.

@RonanLOUARN
Created October 4, 2016 13:37
Show Gist options
  • Save RonanLOUARN/9ee8fafd6053075c53549fbf713e5e6b to your computer and use it in GitHub Desktop.
Save RonanLOUARN/9ee8fafd6053075c53549fbf713e5e6b to your computer and use it in GitHub Desktop.
return false if number.class != Fixnum
array = number.to_s
if array.size == 3
array_checked = [array[0].to_i, array[1].to_i, array[2].to_i, array[0].to_i * array[1].to_i, array[1].to_i * array[2].to_i, array[0].to_i * array[1].to_i * array[2].to_i]
elsif array.size == 2
array_checked = [array[0].to_i, array[1].to_i, array[0].to_i * array[1].to_i]
else
array_checked = [array[0].to_i]
end
if array_checked.uniq.size < array_checked.size
false
else
true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment