Vote UpVote

Provable Optimization with Microsoft Z3

Craig Stuntz's Weblog – A few months ago, some coworkers sent around a Ruby challenge. It appears simple, but we can sometimes learn a lot from simple problems. Write a Ruby program that determines the smallest three digit number such that when said number is divided by the sum of its digits the answer is 20. In case that’s not clear, let’s pick a number, say, 123. The sum of the digits of 123 is 6, and 123/6 = 20.5, so 123 is not a solution. What is? Here’s some Ruby code I wrote to solve it: def digitSum(num, base = 10) num.to_s(base).split(//).inject {|z, x| z + x.to_i(base)} end def ...
Favorite? Off-Topic? Craig Stuntz @ 2015-03-06 05:55


Visits: 1059
Votes: 0
Favorites: 0
Off-Topic: 2

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)