[pythonvis] Interesting problems from last night's chat

  • From: "Richard Dinger" <rrdinger@xxxxxxxxxx>
  • To: <pythonvis@xxxxxxxxxxxxx>
  • Date: Fri, 16 May 2014 08:48:18 -0700

There was a request at yesterday’s chat meeting to have some simple yet 
complete programming problems to solve.  The idea was to hold someone's 
interest a little better than writing ‘hello world’.

JDog is writing a small program that gets values for a height and width from 
the user and then draws the box using –, + and | characters.  This is small, 
but complete having input, processing and output.  Give it a try.

Once you have think python chapters 1 through 4 under your belt, you can try 
the following puzzle that I mentioned at the meeting.  This puzzle cries out 
for a brute force computer solution:

Find the largest number that is divisible exactly by each of its digits.  The 
number may not have any repeating digits or a 0 digit.  For example the number 
42 is divisible exactly by 2 and 4.  Note the largest number without any 
repeating digits is 987654321, but it is clearly not divisible exactly by some 
of its digits like 5.  That gives you a starting point though.  Hint: work out 
your algorithm on three or four digit numbers if grinding through nine digit is 
too slow.  After it works, how fast can you make it?

Richard

Other related posts: