-
-
Save you-ssk/5f94795e5c9829d6785ab672f06a223d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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