Jump to content

Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse


Member Since --
Offline Last Active Today, 04:39 AM

#340959 Upside Down Cake

Posted by plasmid on 06 November 2014 - 03:51 AM

I'm not sure we're completely understanding each other, but here goes.
Spoiler for

  • 1

#340958 Marked Hat

Posted by plasmid on 06 November 2014 - 03:28 AM

Spoiler for

  • 1

#340259 Freebirds

Posted by plasmid on 20 September 2014 - 03:40 PM

Spoiler for

  • 1

#339452 optimal game strat

Posted by plasmid on 12 August 2014 - 04:40 AM

Here's a concrete example.

I tried modifying the code so it generates a matrix of steps to get from each starting point to each goal, just like the matrix I posted earlier, and runs from 1 to 30 so I could directly compare the matrices they produce. They differ at some spots, one of which is the path going from 11 to 3. For some reason it took four steps and went 11/11=1, 11+11=22, 22/11=2, 2+1=3. Obviously a shorter path would be 11/11=1, 1+1=2, 1+2=3.

Apparently there are two equally short paths from 11 to 2: {11/11=1, 1+1=2} and {11+11=22, 22/11=2}, and the algorithm ended up storing the second path as the most efficient path to get to 2. However, since it didn't store the path to 2 that creates 1 as an intermediate rather than 22, it wasn't able to discover that you could reach 3 from a path going to 2 through 1 that had a useful intermediate already generated.
  • 1

#339390 optimal game strat

Posted by plasmid on 06 August 2014 - 07:21 AM

I've been trying to figure out what makes your code run so much faster, and I think I can more or less follow its logic but I'm not sure about one point. If you wanted to get from a starting point of 1 to an ending point of 7, you could do that with

With the algorithm, after you get one path with
1, 2, 4
and another path with
1, 2, 3
it looks like the first of those sets wouldn't allow you to add 4 in the next round because there is already a different path to reach 4, and the second of those sets wouldn't allow you to add 3 in the next round because there is already a different path to reach 3. (This is from the next if (exists($m->{$result})); line.) I'm wondering if it would have a way of discovering that path to 7?

For the most part our algorithms seem to agree, but when I set the max size for both algorithms to 30, mine said you can go from 25 to 13 in 4 steps (from the matrix in my earlier post) while yours said that 25 to 13 took 6 steps (when I commented out the
if ($start{$s}{$STEPS} == $start{$start_best}{$STEPS}) {
and subsequent close bracket surrounding the print statement). A path with four steps is:
25/25 = 1
25+1 = 26
1+1 = 2
26/2 = 13
  • 1

#339107 I'm not a rebellious missionary

Posted by plasmid on 16 July 2014 - 06:14 AM

Heaven sent with company
Clad in cloaks of four or three
Straight and narrow I'll not be
Thus my fate is cast

Sawn asunder as you're fain
In coffin uninterred lie slain
'neath ice with blood-stained ball and chain
Gouged until the last
  • 0

#339028 Sacrifice Mice

Posted by plasmid on 13 July 2014 - 06:54 PM

That should work. I had a different answer in mind.
Spoiler for

  • 1

#338758 Max. # of convex/concave hexagons possible using 6 points

Posted by plasmid on 27 June 2014 - 05:17 AM

Spoiler for a few more

  • -1

#338697 First 2014 puzzle. Dissection of a triangle

Posted by plasmid on 22 June 2014 - 10:09 PM

Spoiler for revised answer with changes in red

Edit: added the figure back
  • -1

#338691 First 2014 puzzle. Dissection of a triangle

Posted by plasmid on 22 June 2014 - 04:55 PM

Drat. I just looked over that again and saw that I divided instead of multiplying when manipulating that equation after introducing the deltaA term, so it won't work.

  • -1

#338643 Four-legged stool

Posted by plasmid on 17 June 2014 - 03:35 PM

Spoiler for

Edit: This assumes that the legs of the stool form a square. Determining whether it applies if the legs are in any other orientation is left as an exercise for the reader.
  • 1

#338586 The "aha!" problems 5. Four-point square

Posted by plasmid on 07 June 2014 - 03:52 AM

If lines AC and BD are perpendicular and of different length, then line D-D' will not have two different perpendiculars with one going through A and one going through C... both perpendiculars will emanate from the same point. So in the end it wouldn't really describe a square so much as a point whose "edges" if extended would touch each of the four points.

But I do think your solution is far more Aha-y.
  • -1

#338371 Riffle Shuffle

Posted by plasmid on 19 May 2014 - 04:04 AM

Spoiler for

  • 1

#337817 Random number probability

Posted by plasmid on 16 March 2014 - 04:45 PM

Spoiler for

  • 1

#337779 collatz sequence^2

Posted by plasmid on 13 March 2014 - 04:17 PM

The thing I still don't understand is whether or not you can prove that you've got a set of generating functions that will cover all numbers that will converge. That's why I took the different approach of starting at the number 1 and applying the algorithm backwards -- if you can cover all cases that can be reached by working from 1 backwards then you know you've covered every number that converges, so any number not on that list can't converge. I just can't come up with an adequate way to show definitively that I've covered all generating functions of the form
(n x 2a + 1) x 2b
by finding all values of n using the function
sqrt(n x 2a + 1) = next value of n

In fact I know I'm missing some numbers that do converge, maybe because the generating function behaves strangely at higher values or something, because my approach didn't pick up that 47, 93, and 185 converge using the list of numbers generated in the previous perl program. (Either that or maybe rounding errors are making my computer miss whether it's dealing with integers or not after taking log base 2.)

If you want to make a list of numbers that your functions cover, you could compare it to the list of the numbers from 1 to 200 that appear to diverge: 27, 39, 43, 51, 53, 55, 59, 71, 45, 77, 79, 83, 85, 87, 91, 95, 99, 101, 103, 105, 107, 109, 111, 115, 117, 119, 123, 135, 139, 141, 143, 147, 149, 151, 153, 155, 157, 159, 163, 165, 167, 169, 171, 173, 175, 179, 181, 183, 187, 189, 191, 195, 197, 199 and multiples of powers of two for each of those.
  • -1