## 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

# EventHorizon

Member Since --
Offline Last Active Dec 10 2012 10:28 PM

### An Unfair Coin 3: Return of the Golden Inequality

28 July 2012 - 12:23 AM

The golden ratio is (1+sqrt(5))/2. The reciprocal of this happens to be (sqrt(5)-1)/2 which is about .618.

I happened to have a biased coin that would come up heads with exactly that probability. This was my lucky coin, and I used it to bias my decisions slightly towards the ones I favored. It was quite a tragedy when I lost this coin (not only for it's decision making qualities, but it was, coincidentally, made of gold).

How can I simulate a coin toss from my missing lucky coin using a fair coin instead?

### An Unfair Coin 2: Fairness Strikes Back

27 July 2012 - 01:02 PM

I took the coin from ujjagrawal's post out of the biased random number generators jar that had been collecting dust in the corner of the Den, but I needed to choose between two options with 50% probability each. I thought this would be easy since I already calculated the probability that heads would come up for this coin.

Spoiler for Hint to 1, and info from ujjagrawal's puzzle

1) How can I choose between the two options with 50% probability?

2) I accidently drop ujjagrawal's coin in the jar, and now don't know which one it is. I grab another coin from the jar. How can I choose between the two options with equal probability using this new coin (assuming both heads and tails can be outcomes on any given flip and occur with constant probabilities)?

3) How can I use the coin from (2) to choose between N options, where N is a positive integer, with the fewest number of coin flips needed on average?

### Ripping BrainDen to an XML File -- Thoughts?

22 July 2012 - 05:57 AM

Someone posted that they would like to have a paper copy of brainden to take on flights, camping, etc. I thought it would be nice to have a local electronic copy to search through, annotate, rank, mark favorites, mark ones to work on later, etc. It wouldn't be too hard to export from an electronic copy to a text document then into a word processor to format and print it out. XML is a standard, so I thought I may use that to store it.

I played around with handling XML documents in java (I generally use java when I want GUIs) and worked up a simple little XML editor and started manually copying and pasting puzzles into an XML document (and replacing images with text art). This turns out to be a very slow process. I got to around thread 1700 of 15000 (580 total puzzles in the file) before deciding there was a better way to approach it (though it was interesting to see all the unsolved puzzles and old puzzles I had forgotten about but liked). Not only this, but I wasn't recording who posted the puzzles, who gave the solutions, when it was posted, the brainden topic number (to easily find the topic on brainden later), etc.

Spoiler for For those who want to see my simple editor and incomplete database

I'm thinking I'll write a bash script to rip the first posts of all topics to a file, then manually prune repeats and other undesirables (should be much faster since I'm not loading web pages, and I won't be loading topic numbers that reach an error page), then manually go through each of them and find the posted solutions and add text art or descriptions in place of images.

I think I'll get at least the following pieces of information using the bash script:
-post date
-topic number
-who posted it
-title (if it exists)
-subforum it came from (ignoring the whole miscellaneous subforum)
-puzzle description (ie, the actual puzzle)

I'll do the following manually (after pruning undesirables):
-add solution (and person who posted it) or mark unsolved
-add tags to tell what kind of puzzle it is
-add Title (if it doesn't have one I'll make one up)
-replace images with text art or descriptions
-fix formatting

Here are some of the tags I'm thinking of using:
Spoiler for In a spoiler to conserve space

As for the viewer/editor, I'll plan to add in the following features:
-Export to text document (puzzles with their solutions or all puzzles first solutions after)
-Import file into current list
-Easily edit anything
-Can add in fields or tags and name them
-Tags as checkboxes
-Separate tab for each field (bigger text areas and don't need to see solution unless you click its tab)
-Ability to list by requested tag(s) and/or rank

Here are the questions I have:
Is there a better way to go about it than this approach?
Am I missing something that could easily be ripped using a script?
Should I not include some of the information listed above or include something else?
Did I miss any tags that would be good to use or do I have a useless one?
What other features should the new editor have?
Do you think this would be useful, or is it a waste of time?
Would anyone be interested in helping once I get to a point where I can divide workload?

### Arrangement, Again and Again

09 July 2012 - 02:03 AM

Inspired by wolfgang's post, I thought I would give my own.

2,4,3,1,6,5,7
3,7,5,6,1,8,2,4
2,7,6,3,9,4,8,5,1

1) What would it be for 10 numbers? What method am I using?

Here's another one (but it is (hopefully) harder, so I'll give all of them up to 9):

1
1,2
1,2,3
4,1,3,2
3,1,4,5,2
6,3,2,5,4,1
1,4,3,2,6,5,7
5,7,8,6,4,1,3,2
4,5,8,6,2,7,3,1,9

2) What is the order for 10 numbers? What is the method?

### Happy Pythagorean Triple Day!! Also, Mother's Day.

14 May 2012 - 01:08 AM

Yes, I know Mother's Day is the much bigger deal (Happy Mother's Day to all mothers out there! I hope you feel loved and appreciated every day of the year.).

However, today's date is a Pythagorean triple (5/13/12, 52+122=132), so I thought I'd post some math questions regarding Pythagorean triples.

But first, here are some definitions to those who don't know what Pythagorean triples are:

The Pythagorean theorem states that for a right triangle whose sides are of length a, b, and c where c is the longest length (the one opposite the right angle), a2+b2=c2.

If all three of a,b, and c are positive integers, then {a,b,c} is a Pythagorean triple.

Now, in honor of Mother's Day I'll call a Pythagorean triple a mother triple if there is no d greater than 1 such that {a/d, b/d, c/d} is also a Pythagorean triple (equivalently, at least 2 of {a,b,c} are relatively prime). Otherwise, it is a child triple.

Here are the questions:

1. Let the date be of the form xx/yy/zz (ie, two digit year, any can be c (the longest)). What are the next 3 days that are pythagorean triples?

2. How many dates are mother triples given the two digit year? How many total dates are Pythagorean triples?

3. How many total dates are triples given a four digit year?

4. What was the last date that was a pythagorean triple given a four digit year?