[AccessD] OT: Friday Puzzles

Drew Wutka DWUTKA at Marlow.com
Mon Apr 26 09:58:12 CDT 2010


Not possible that way....

Look at it like this (visually):

100 soldiers.

70 lost an eye, so 30 did not lose an eye.

75 lost an ear, so 25 did not lose an ear.

So let's look at this graphically, remember, we are looking at results
for the same group of 100 soldiers, not different soldiers:

  5| 10| 15| 20| 25| 30| 35| 40| 45| 50| 55| 60| 65| 70| 75| 80| 85| 90|
95|100|
eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|   |   |   |   |
|   |

Above, I have shown a 'graph' of sorts, that shows groups of five.  Now
let's put in the ear group:

  5| 10| 15| 20| 25| 30| 35| 40| 45| 50| 55| 60| 65| 70| 75| 80| 85| 90|
95|100|
eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|   |   |   |   |
|   |
ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|   |   |   |
|   |

Looking at it this way, we see that the MOST that have both is 70, and
the most that have NOTHING is 25.  But we don't care about who had
nothing, having one or the other doesn't qualify for the generals medal
of having all 4 (though we are only looking at two right now)
'conditions'.  So with just the first two conditions, what is the least
number that can have both?  With our 'graph' here, we just have to slide
one of them to the other side, like this:

  5| 10| 15| 20| 25| 30| 35| 40| 45| 50| 55| 60| 65| 70| 75| 80| 85| 90|
95|100|
   |   |   |   |   |
|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|
ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|   |   |   |
|   |

Looking at it this way, we see that the minimum number that can have
both conditions is 45.  It doesn't matter how you span it, if you have
70% of a group with condition A, and 75% of the SAME group with
condition B, you will have AT LEAST 45% of the group with BOTH Condition
A and Condition B.  (So that's 100%-(%withoutA+%withoutB), or
100%-(30%+25%)=45%)

If we add the other two conditions, again, it doesn't matter which way
they slide on the scale, they are bigger than the first two conditions,
they will always overlap them:

  5| 10| 15| 20| 25| 30| 35| 40| 45| 50| 55| 60| 65| 70| 75| 80| 85| 90|
95|100|
   |   |   |   |   |
|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|eye|
ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|ear|   |   |   |
|   |
   |   |   |
|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|arm|
leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|leg|   |
|   |

Still at the magic number of 45%.  Now in Arthur's original post, he did
have a slight slip, by stating '85% of the soldiers had lost one leg',
where the other three conditions all had clauses like 'at least one', or
'at a minimum', but if we were to take that literally, it's a
mathematical impossibility to have 85% only losing one leg (and nothing
else).  To answer his riddle, he asks who, at a minimum, lost one eye,
one ear, one arm, AND one leg, which is anywhere from 45% to 70%.  The
minimum to the maximum overlap of the conditions.

This was a great puzzle for relational database developers.  When it
comes to Joins, we often thing of the overlapping circles, which
represent different groups of data.  But when it comes to data metrics,
we sometimes have to look at our joins in different ways.  In this case,
4 subsets all within one set.  So Arthur's puzzle could easily have been
a task a developer would have to figure out for a client, here it is in
a real world example:

Your client wants a database to track Returned Goods.  There are 4
possible conditions (A,B,C,D) in which a product will be returned. RG's
can be returned for any combination of A,B,C, or D.  One of the reports
your client wants, is a report showing returned goods with all 4
conditions, compared to the Max and Min that could have been returned
with all four conditions based on the percentages returned with each
condition.  (ie, assuming Arthur's percentages, as RG reasons, and not
injuries), a client might have 68% returned with all four conditions, so
the report would show that his returned goods are hitting all 4
conditions on the higher end of the possible range.

Drew


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kevin
Sent: Saturday, April 24, 2010 1:24 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Friday Puzzles

OK...
I would like to revise and extend my remarks...
Assuming an army of 100, 10 lost all 4

70 lost an eye
	So 30 did NOT lose an eye
75 lost an ear
	So 25 did NOT lose an ear
80 lost an arm
	So 20 did NOT lose an arm
85 lost a leg
	So 15 did NOT lose an leg

The soldiers that retained at least one of the body parts is 90
(30+25+20+15
= 90) meaning that 10 lost all 4.

Kevin Waddle
"The time has come," the Walrus said,
"To talk of many things:
Of shoes--and ships--and sealing-wax--
Of cabbages--and kings--

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: Saturday, April 24, 2010 10:22 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Friday Puzzles

That's wrong, and a bit(?)/plain(?) stupid, sorry. Any, takers? (I'm off
till tomorrow's late evening/Monday).

Thank you.

--Shamil

-----Original Message-----
From: Shamil Salakhetdinov [mailto:shamil at smsconsulting.spb.ru] 
Sent: Saturday, April 24, 2010 7:30 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] OT: Friday Puzzles

8925 medals.

Correct?

x = size of the army
y = qty of soldiers who have lost one arm, one leg, one ear and one eye;

y = 0.85*(1-0.8)*0.75*0.7x

Assuming that army size is between 100,000+ and 150,000
(
http://www.secondworldwar.co.uk/units.html
http://usmilitary.about.com/od/army/l/blchancommand.htm
)

the anwers would be

foreach (int x in Enumerable.Range(100000,50001))
{
    decimal y = 0.85m * (1.0m-0.8m) * 0.75m * 0.7m * x;

    if (y == (decimal)(int)y)
        Console.WriteLine("// SizeOfTheArmy={0:#,0}+, Medals={1} ", 
            x, (decimal)(int)y); 
}

// SizeOfTheArmy=100,000+, Medals=8925
// SizeOfTheArmy=104,000+, Medals=9282
// SizeOfTheArmy=108,000+, Medals=9639
// SizeOfTheArmy=112,000+, Medals=9996
// SizeOfTheArmy=116,000+, Medals=10353
// SizeOfTheArmy=120,000+, Medals=10710
// SizeOfTheArmy=124,000+, Medals=11067
// SizeOfTheArmy=128,000+, Medals=11424
// SizeOfTheArmy=132,000+, Medals=11781
// SizeOfTheArmy=136,000+, Medals=12138
// SizeOfTheArmy=140,000+, Medals=12495
// SizeOfTheArmy=144,000+, Medals=12852
// SizeOfTheArmy=148,000+, Medals=13209

As we do not have the general's army size defined but we know that
general
wanted to reward teh fewest number of soldiers then we select the
minimal
appropriate army size = 100,000 soldiers, and then the answer will be
8925
medals.

Correct?

Thank you.

--Shamil

<<< snip >>>

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list