[Tutor] Algorithm Question

Daniel Coughlin kauphlyn@speakeasy.org
Tue, 8 Jan 2002 17:31:52 -0800 (PST)


This isnt really a python question per se, but rather a question about a
specific algorithm. I am no math wiz, and wondered if any of the math guru's on
this list could help me sort this out, or at least point me in the right
direction.

I need to take in a variable quantity of integers (850,250,375,etc) and return a
list of all the possible sums of the numbers in the list given when each of
these is multiplied by say one through ten. To make
it a little simpler I'll
use a simpler example: input = (5, 10); output = (15,25,30,etc) all multiples of
5 up to 150.

a similar algorithm would be to systematically generate all possible pin codes
for a bank machine - given four fields (lets say you are only using two
numbers, 1 and 0) find all possible arrangements :
(0001,0010,0100,1000,1001,1011,1111,0000,0110,1010,0101,1100, etc)

How does one go about solving these types of problems with some kind of
efficiency?

I hope this clear.

Any help would be appreciated!

Daniel