Re: Population puzzle

2014-09-26 Thread Geoff Canyon
This is a fun problem. My first, nearly brute force solution simply maintained an array with the keys being the sum of the value lists stored in the array -- so X[5] might contain 2,3. The only optimization inherent in this is that it doesn't worry about duplicate sums along the way. So if there a

Population puzzle

2014-09-25 Thread Mick Collins
I’ve been working on this one for a few minutes, a few there and finally got it, a month later. Great puzzle, Michael, thanks! > From: Michael Doub > To: How To use LiveCode use LiveCode > Subject: Population puzzle > Message-ID: <23af2370-8161-458a-91c6-22153c15f...@gmail.com&

Re: Population puzzle

2014-08-26 Thread Peter M. Brigham
I haven't tried to actually write script for this, but it occurs to me that you could first find all the sets of numbers whose last digits add up to a multiple of 10 (or whose last 2 digits add up to a multiple of 100, etc), then iterate through a much smaller group of sets to test for their tot

Re: Population puzzle

2014-08-25 Thread Michael Doub
Well, I have been trying to come up with a logical approach since I posted the puzzle and I still don’t have a solution. You all may not have a logic based approach, but at least you got a solution. Right now the straight forward approach with some randomness thrown in looks pretty good to m

Re: Population puzzle

2014-08-25 Thread Terry Judd
Ditto for me, and mine was messier than Scott¹s as well. Still it kept me occupied while I was eating my lunch :) Terry... On 25/08/2014 5:27 pm, "Scott Rossi" wrote: >I imagine my approach would be faster if it followed ANY logic. :-) > >Regards, > >Scott Rossi >Creative Director >Tactile Med

Re: Population puzzle

2014-08-25 Thread Kay C Lan
LOL :-) On Mon, Aug 25, 2014 at 3:27 PM, Scott Rossi wrote: > I imagine my approach would be faster if it followed ANY logic. :-) > > Regards, > > Scott Rossi > Creative Director > Tactile Media, UX/UI Design > > > > > On 8/24/14 11:38 PM, "Kay C Lan" wrote: > >>I imagine Terry & Scott, your ap

Re: Population puzzle

2014-08-25 Thread Scott Rossi
I imagine my approach would be faster if it followed ANY logic. :-) Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 8/24/14 11:38 PM, "Kay C Lan" wrote: >I imagine Terry & Scott, your approach would on average be faster if >you followed the same logic.

Re: Population puzzle

2014-08-24 Thread Kay C Lan
OK, well I think I can do a little better than that. I can consistently get an answer in a sec, which I guess you could beat if you happen to be lucky with your first selection of random cities. I do also appreciate that Terry's code is slowed a little by counting the iterations which mine doesn't.

Re: Population puzzle

2014-08-24 Thread Scott Rossi
If I understand the challenge, the goal is to find some combination of the numbers that adds up to 1. If this isn't right, ignore the following. If the above is true, then here's a brute force randomized solution that arrives at the answer by chance, has no mathematical logic, and will li

Re: Population puzzle

2014-08-24 Thread Terry Judd
OK - I¹ll take the bait although elegant algorithms definitely aren¹t my forte. As a result this is probably a very half-baked and inefficient solution to the problem but it seems to work and doesn¹t have to resort to recursion (which I can never get my head around) to generate the starting combina

Re: Population puzzle

2014-08-24 Thread Mark Wieder
Michael- Sunday, August 24, 2014, 4:52:43 PM, you wrote: > I know that some of the folks on this list enjoy puzzles. A > friend sent me this one this afternoon and I thought it would be > interesting to see the different approaches folks come up with and > how fast it can be solved. enjoy… >

Population puzzle

2014-08-24 Thread Michael Doub
I know that some of the folks on this list enjoy puzzles. A friend sent me this one this afternoon and I thought it would be interesting to see the different approaches folks come up with and how fast it can be solved. enjoy… The 2010 Census puts populations of 26 largest US metro areas at 1