Skip to content

Instantly share code, notes, and snippets.

@bragboy
Created November 12, 2015 10:54
Show Gist options
  • Select an option

  • Save bragboy/de770dde59358f5398d9 to your computer and use it in GitHub Desktop.

Select an option

Save bragboy/de770dde59358f5398d9 to your computer and use it in GitHub Desktop.
(101010107..199999999).step(10) do |n|
if ((n*n).to_s.gsub /(.)./,'\1') == "123456789" || (((n-4)*(n-4)).to_s.gsub /(.)./,'\1') == "123456789"
puts "The unique positive number is #{n*10}"
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment