Skip to content

Instantly share code, notes, and snippets.

@you-ssk
Created October 6, 2016 08:04
Show Gist options
  • Save you-ssk/5f94795e5c9829d6785ab672f06a223d to your computer and use it in GitHub Desktop.
Save you-ssk/5f94795e5c9829d6785ab672f06a223d to your computer and use it in GitHub Desktop.
s = 345
d = 5
rr = {}
pk = 0
r = Hash.new{|h,k|h[k] = []}
while true do
s += 1
k = (s ** 3).to_s.chars.sort.join
r[k] << s
if k.size != pk
rr = r.select{|k,v| v.size == d}
break unless rr.empty?
r.clear
end
pk = k.size
end
p rr.values.map{|v| v[0]}.min ** 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment