Jump to content
The Dark Mod Forums

Riddles! I've got some! Who else?


slavatrumpevitch

Recommended Posts

Hey everyone,

 

I'm always in the hunt for some clever riddles. I'll offer up some that I've enjoyed, and then open it up to anyone else to chime in.

 

If we could, I'd appreciate if we could limit ourselves to true logic-puzzle/math riddles, no joke riddles or lateral thinking riddles. (someone can create another thread for that, if they so choose)

 

Also, please "spoiler"-out any hints, solutions, or explanations.

 

Alrighty, now that we've got that out of the way, here are a couple of my favorites:

 

in roughly ascending order of difficulty (though that is fairly subjective):

 

 

 

 

1. Describe the set of all points on the earth such that walking south for a mile, then walking east for a mile, then walking north for a mile will render the walker back at the starting point. (assume a perfectly spherical earth)

 

 

 

 

 

2a. A man tells you he has two children, and that he has a daughter named Alice. What is the probability that he has two daughters? (assume boys and girls are each born with 50% probability)

 

b. A different man tells you he has two children, and that he has a daughter named Stacey who was born on a tuesday. What is the probability that he has two daughters? And if it is different, than part (a), why is this?

 

 

 

 

 

 

3. If there are N cars (with random starting points) traveling in the same direction at constant, (strictly positive), and unique speeds on an infinitely long 1-lane road until the proximity of the car in front mandates that a car slows to the match the speed of the car in front, after an infinite amount of time elapses, what is the expected number (as a function of N) of "clumps" of cars?

 

 

 

 

 

4. Three perfect logicians are forced to play the following game: each logician is given a hat that is either white or black. They cannot see their own hat, but they can see the hats of the other two players. No information is exchanged. After a brief time, they are escorted into separate interogation rooms where they have the opportunity to say either "white" or "black" or remain silent. If everyone remains silent, they are all executed. Similarly, if any one person says a color other than the color of his hat, they are all executed. However, if at least one of them correctly identifies their hat color, and no one incorrectly names a color, they are all given a million dollars, and sent on their way. What should they do to maximize their chances of survival?

 

Assume nothing about the distribution of white and black hats, but you can assume that the fact that they are all perfect logicians is common knowledge.

 

 

 

 

 

 

5. You are standing in a room with three doors marked A, B and C. Two of them lead to Hell, and one to Heaven. There are 3 identical looking men, wearing hats marked 1, 2 and 3. One of them will answer truthfully to every logically answerable yes/no question. One will lie to every logically answerable yes/no question, and one of them will answer randomly to any question. (All of them will answer randomly to an unanswerable question.) All three people have perfect information about eachother, and perfect information about the doors. Unfortunately, they are somewhat uncomfortable with English, and while they will understand your questions, they will respond only with "Hi" and "Ho" meaning 'yes' and 'no', but you don't know which means which. (They may even mean different things to different people!) You may ask up to 3 questions, each one directed to a single person (though you may ask a single person multiple questions). What should you ask to guarantee you find the door to Heaven?

 

examples of unanswerable questions:

 

What is the value of 2+2? (not a yes/no)

What would the person who answers randomly say if I asked them...? (not knowable)

 

Good luck!

 

If anything is unclear, I'll try to be diligent about clarifying any questions that crop up over the next few days.

 

Can't wait to see some of your riddles!

  • Like 1

Milestones approaching:

Recital: 3-24-12

ToughMudder: 4-15-12

Release first FM: ?-?-20??

Link to comment
Share on other sites

I'll see about answering those later, when it's not so late.

 

But my favorite ones that I remember (you mentioned the 3 hats one):

 

1. Knight & Dragon. A dragon and knight live on an island. This island has seven poisoned wells, numbered 1 to 7. If you drink from a well, you can only save yourself by drinking from a higher numbered well. Well 7 is located at the top of a high mountain, so only the dragon can reach it.

One day they decide that the island isn't big enough for the two of them, and they have a duel. Each of them brings a glass of water to the duel, they exchange glasses, and drink. What's the knight's best strategy to win the duel?

 

2. "Einstein's riddle" apparently. I actually did this yesterday *without* using paper, just in my head (and using my fingers for reference), and got to the right answer. It's a typical kind of what we now think of as a grid logic problem. It's trying to do it without a grid that's the challenge.

 

Assume the following setup:

 

1. In a street there are five houses, painted five different colours.

2. In each house lives a person of different nationality

3. These five homeowners each drink a different kind of beverage, smoke different brand of cigar and keep a different pet.

 

THE QUESTION: WHO OWNS THE FISH?

 

HINTS

 

1. The Brit lives in a red house.

2. The Swede keeps dogs as pets.

3. The Dane drinks tea.

4. The Green house is next to, and on the left of the White house.

5. The owner of the Green house drinks coffee.

6. The person who smokes Pall Mall rears birds.

7. The owner of the Yellow house smokes Dunhill.

8. The man living in the centre house drinks milk.

9. The Norwegian lives in the first house.

10. The man who smokes Blends lives next to the one who keeps cats.

11. The man who keeps horses lives next to the man who smokes Dunhill.

12. The man who smokes Blue Master drinks beer.

13. The German smokes Prince.

14. The Norwegian lives next to the blue house.

15. The man who smokes Blends has a neighbour who drinks water.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

I've been working on #3. There's a "simple" part and a "tricky" part. The "end" clumps are easy to factor in; the "middle" clumps are harder as you move more in to the middle. I've made a lot of headway and have the algorithm to get the answer (if it were a program), but I still need to get it crystallized into a formula with n. I just wanted to report, but I don't want to give the answer until I have the whole thing ready.

 

The basic gist though ...

 

I'm taking expected value to mean the average value, if you ran the experiment an infinite number of times, the number of clumps on average you'd see. Even if you meant something else I don't care at this point, lol, because I've worked so much on this, the average is tough enough & fine for me. So it's a fraction with the denomenator being the "unique arrangements possible" (I mean the total possible arrangements you could order the n cars, with the assumption they're equally likely), basically just n!, and the numerator being the collective (weighted) "clump-value" summed over all those arrangements. (By clump-value, I mean if the first arrangement has 3 clumps, that'd be +3 to the numerator, if the 2nd arrangement has 2 clumps, it'd be +2, and you'd go on counting in that way until you've covered all the n! arrangements and have the total number of clumps (weighted values) across the whole arrangement-space.) n(2) is an easy example. There are two possibilities A-B, and B-A (n!=2) so that's the denomenator; in the first case there'd be 2 clumps (+2), in the second case there'd be 1 clump (+1), so 1+2=3 total clumps for the whole field. So that's the numerator. Then 3/2=1.5 would be the average # of clumps you'd expect from the field (basically 1-clump half the time, and 2-clumps half the time).

 

So for n(2), the average # of clumps over many trials would be (3/2) = 1.5

n(3) = 11/6 = 1.83

n(4) = 50/24 = 2.083

n(5) = 275?/120 = 2.2917

etc...

 

I've got a rough algorithm that counts up the clump value for the numerator (I could write a program to get the answer), and I'm seeing the pattern the middle clumps get their values, but I'm not all the way there just yet. The way I'm counting is to add clumps from the field in sets, starting with the clumps in the "back" of the pack and working my way forward to count additional clumps farther forward that I haven't counted yet (since there's an easy way to make sure a more-front clump hasn't already been counted as a clump farther back, described below).

 

So I know the end points of the sum are going to look like: n! +[sum of remaining cases...] +(n-1)(n-1)!

 

The first clause counts all the "back" clumps (easy, the slowest car will always be in it, and since the slowest car is in every arrangement, there will always be that 1 clump for every arrangement as the back clump). The final clause counts all the uncounted "front" clumps (basically each time a car other than slowest (i.e., n-1 cars) is in 1st place (which happens (n-1)! times for each of those cars).

 

For n(2) this alone would give you the right answer easily enough, since there can only be front &; back clumps. It's just when you get into middle clumps (n>2) where it gets trickier to count because it nests in dealing with the *other* remaining cars to know whether it's already been counted or not. [it's interesting for n=3, all the clumps are either front or back clumps *except* for one middle clump, and my equation above will count all those front & back ones but miss the middle one: n! [front clumps] + (n-1)(n-1)! [backclumps] = 10 end clumps, but the numerator should be "11" with that one middle clump. So I knew I had more work to add factors to get that middle clump into the sum.]

 

To give a couple of examples of how those middle clumps work:

 

For every car where we're asking if it's in a new middle clump (i.e., cars from 2nd place to n-1 place), there are (n-i) slots open behind it to fill with the other cars, with equal probability (based on their number). The car we're looking at will only be in a "new" clump we haven't counted yet if all the slower cars are in those slots (we don't really need to specify every case; all we really need is the % of cases where all the slower cars are in those slots, and that gives us the % of cases with a new clump.)

 

So if we're looking at n=4, (car1 is fastest, car4 slowest), say car3 in 3rd place. There's 1 slot behind it open (n-1)! times in the arrangement-space (i.e., 6 times). There's 3 remaining cars, so 1/3 chance car4 is in that slot. (We need car4 in that slot to count the current car in a "new" clump we haven't already counted.) Since (n-1)!=6, a 1/3 chance = 2 times that slot is filled with car4, so that tells us there are 2 new clumps here in the field we haven't counted yet.

So we'd add 2 to the numerator sum for this iteration.

 

If we're looking at n=4, car3 in 2nd place, there's 2 slots behind it (n-1)! (i.e., 6) times, again 3 remaining cars but filling 2 slots now...

But we only care if car4 is in one of those slots (either one). There's a 1/3 chance it's in the first slot (=2 times), and a 1/3 chance it's in the 2nd slot (=2 times). 2+2=4 new clumps, so we'd add 4 to the sum on this iteration.

 

Now n=3, car2 in 2nd place. There's 2 slots behind it (n-1)! times.

We must have car3 in one of the slots AND car4 in one of the slots (both of them need to be back there for this car to be in a new clump we haven't counted yet.)

Car3 has a 1/3 chance to be in a slot (would=2), but times 1/2 a chance in addition that car4 is in the next slot (=1)

Car4 has a 1/3 chance to be in a slot (would=2), but times 1/2 a chance in addition that car3 is in the next slot (=1)

1+1=2 total to add to the sum for this iteration.

 

If we're looking at n=5, car 3 in 3rd place, there's 2 slots behind it (n-1)!times (=24 times)

We want cars 4 AND 5 to fill those 2 slots.

Car4 has a 1/4 chance to be in a slot (would=6), times a 1/3 chance car5 is in the other slot (=2)

car5 has a 1/4 chance to be in a slot (would=6), times a 1/3 chance car4 is in the other slot (=2)

2+2=4 total to add to the sum for this iteration.

 

Etc. I think you see the general trend. So the way you'd organize it as a general method would be to start with car(n-1) in each relevant place and work your way systematically up to car2 (not car1 of course because if all the other cars are behind it, it's in 1st place and counted with that last term, and car.n-led clumps were already counted with the first term; they couldn't have slower cars behind them anyway). And that's basically the forumla you'd use. E.g., for n=4, you'd look at car3 in 3rd place, then car3 in 2nd place, then car2 in 2nd place, sum all of that*, and that covers all the middle clumps for all the middle cars, which is what you need.

*footnote, to do sum for:

- car3 in 3rd: add up % of times car4 is in 4th

- car3 in 2nd: add up % of times car4 is in 3rd & 4th

- car2 in 2nd: add up % of times car3 & car4 are in 3rd & 4th

 

if n=5, you'd look at car4 in 4th, 3rd, 2nd; car3 in 3rd, 2nd; & car2 in 2nd in the same way. This gives you the system to count middle clumps for any n, and you can see the basic repeating pattern.

 

So if you do it right, then add in the back & front clumps we got the "easy" way, you count every clump in the whole arrangment space, without missing a clump and without double-counting one. That's the right numerator.

 

As you can see, I can do all this (middle-clump counting) by hand (or write a program) and get the right answer. But I think every element I need to translate it into an equation I can get from n (that and the "iteration" count (i) from a sum, since you see the repeating 'counting backwards' pattern), which would give me a general equation as a factor of n ... by "elements" I mean, e.g., the number of slots open behind a car(i), the number of remaining cars to fill them and the % of those cars we "care about" (only cars slower than car(i), i.e between i & n = n-i cars), which gives the probability those slower cars are in those slots ... Everything I was using in the formula above to count new clumps... All those things I need I think I can get from n or i (and probably a nested "j" iteration to sum over the places for car(i) ). I just have to work that out and to translate the pattern I'm seeing into that kind of form. But I'm happy that I have the basic gist of the answer now, the path to get to it for any n cars, and the rest is largely just clean-up. Fun problem.

 

BTW after I got the basic gist, I looked to see how other people were looking at it and realized I'm doing it much differently than most anybody else, I guess because they're trained in math so they have a formal way to do it and I was doing it largely visibly, looking down on drawings of cars (actually numbers) with circles around them and seeing how the circles organized themselves. But the fun thing about sums is, it doesn't matter how you organize the thing you're counting. I think they've organized whatever "thing" they're counting in a completely different way than I have, and their equations just look completely different to what I'm doing (I'm summing based on the clump order, back to front; very visual and concrete), but they're going to get to the same answer via different routes. So I'll stick with what I'm doing. One thing about doing it my own way is I can't really be spoiled since other people haven't tried it this way AFAIK. It's fun when two completely different looking equations come to the same right answer every time, then you realize they're different organizations of the same underlying thing.

 

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

 

BTW after I got the basic gist, I looked to see how other people were looking at it and realized I'm doing it much differently than most anybody else... It's fun when two completely different looking equations come to the same right answer every time, then you realize they're different organizations of the same underlying thing.

 

 

Yea, I know what you mean! I love how math can allow for uncountably infinite approaches to the same problem!

 

Somewhat related to that, my brother and I were trying to understand the relationship between e and pi by finding find non-trigonometric derivations for pi.

 

Finally we came up with pi=4(1-1/3+1/5-1/7+1/9-1/11+...) which you could argue is trigonometric b/c it's really just a combination of arctan, and taylor-series. But... you could also just look at it as a sequence of adding alternately negative odd numbers.

Milestones approaching:

Recital: 3-24-12

ToughMudder: 4-15-12

Release first FM: ?-?-20??

Link to comment
Share on other sites

First post, #1

 

Only the starting point needs to be described. If it is at the north pole, then going equal distances south, east (or west) and then north will take you back to the north pole again.

After heading south 1 mile, then going either east or west will keep you exactly 1 mile distant from the north pole because you will be travelling along an arc.

 

System: Mageia Linux Cauldron, aka Mageia 8

Link to comment
Share on other sites

PranQster ...

 

You got one, but maybe there's at least one more place... (Or more...)

 

 

A big hint if you want one...

 

Think of place(s) on the globe where if you walked 1 mile east you'd end up back where you started, and think about it from there.

 

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Ok I've got code written to solve the car problem (#3). Since I'm not a math guy, I'm not sure I can actually translate it into an equation, but writing an algorithm was challenge enough! Even knowing what to do, it was very hard figuring out the logic to actually do it. It's less than a dozen lines, but it took so many wrong turns and guesses and TONS of work. But I got there.

 

Actually my brain is too tired now to final-check it with some examples and see that it's getting the right answers. But I wanted to post it anyway, and if there's still something wrong I'll come back and correct it later on. It should be ok. (Edit: I simplified a few things later.)

 

Here it is...

 

 

// Computes the Average clumps of n cars of different speeds randomly assorted on a 1 lane highway.
// Average = (Sum of clumps in the whole field of possible car arrangements) divided by
// (Total # of possible car arrangements = n!)

Numerator = n! + (n-1)(n-1)!; // Easy way to count all Back & Front clumps right at the start, as explained in my last post.
Denominator = n!;

// The rest of the code sums new middle clumps not already counted
// A yet-uncounted clump is added to the sum for each middle car in each valid middle place
// in the line up when *all* SlowerCars are behind it
// (i.e., a ValidArrangement of SlowerCars in SlotsOpen.
// SlotsOpen just means the positions behind the car
// All we need to do is just compute the number of those ValidArrangements).

For Car = 2 to (n-1)
{
 For Place = 2 to Car // Checking each middle car (car1 is fastest, car.n is slowest)
		   // in each valid middle place in the line-up
		   // (i.e. only positions up to "Car", which have enough
		   // SlotsOpen behind it for all SlowerCars to fit).
 {
	  // ValidArrangements = the number of arrangements where all SlowerCars are
	  // behind it, one way or another. It'll end up being a partial factorial of SlotsOpen,
	  // only as deep as the number of SlowerCars,
	  // e.g., 4 OpenSlots & 3 SlowerCars = 4*3*2=24 ValidArrangements (or 4!-(4-3)! ).

	  SlotsOpen = n - Place;
	  SlowerCars = n - Car;
	  ValidArr = SlotsOpen;
	  For k = 1 to (SlowerCars - 1) // Product, See footnote to explain this.
			 ValidArr *= ( SlotsOpen - k );

	  FasterCars = ( Car - 1);
	  Numerator += ValidArr * FasterCars!;
	   // The # of ValidArrangements of SlowerCars in OpenSlots is multipled to cover the
	   // FasterCars being in different arrangements, e.g., if n=6 and cars 4,5,6
	   // are arranged like (x-x-[car3]-6-4-5), that's "1" ValidArrangement for "car3 in 3rd",
	   // but you need to multiply it by 2! (the factorial of the 2 faster cars) to get the actual
	   // number of new clumps with "car3 in 3rd" in the field with that arrangement
	   // because there are two total arrangements with it: 1-2-[3]-6-4-5 and 2-1-[3]-6-4-5.

	   // Once you have all the clumps for that arrangement, you add it to the sum of all
	   // clumps in the field and move on to the next arrangement.
	   // Then once you cover all ValidArrangements, you've counted all the middle clumps
	   // in the field, which is what we wanted.

 }
}
Average = Numerator / Denominator;
// Fin.

/*
Footnote:
The number of ValidArrangements can be constructed with a tree-diagram of each SlowerCar
in each SlotOpen. All we need is the number of nodes at the end of the tree to
get the number of uncounted clumps they represent; we don't even have to know what
the actual arrangements are. The tree is constructed as a partial factorial
of the # of open slots, but only to the depth of how many SlowerCars. So, e.g., if there's
4 OpenSlots and 4 SlowerCars, it's an easy 4! (each car in each slot). But if there's 4
OpenSlots and only 2 SlowerCars, the factorial is to a depth of 2, i.e., 4*3=12. If there
are 5 OpenSlots and 3 SlowerCars, it's 5*4*3 (a partial-factorial to a depth of 3).
The way we do a partial factorial is just the Product version of Sum, with the symbol capital Pi,
which multiplies OpenSlots * (OpenSlots - 1) a 'SlowerCars - 1' number of rounds (so if there's
just 1 SlowerCar, ValidArr is just OpenSlots). Also if there are *more* SlowerCars than
OpenSlots, like 4 SlowerCars and only 2 OpenSlots, it's going to be 2*1*0*-1, and
ValidArr would go negative, i.e., it's impossible for all the cars to fit in the slots.
The math doesn't car, but reality does, so if ValidArrangements ever went negative, it should re-set to 0,
meaning a ValidArrangement is just impossible for that case and there are no new clumps.
But the "For Place = 2 to Car" part prevents this problem altogether. A fast car is never
checked farther back than there are SlotsOpen for SlowerCars, so no need for the correction.
*/

 

 

 

Edit: How I figured it out.

 

The key insight was looking at the tree diagram of all the arrangements adding new clumps. I saw that all of them had a kind of factorial shape (4 nodes, each branching to 3 nodes, each branching to 2...), which made me realize I didn't have to actually get the arrangements. All I had to do was reconstruct the shape of the tree, and the total number of nodes at the top of the tree would give me the number of arrangements, and thus clumps, there were. The only catch was not all of the trees has branches going back to 1 (in the factorial form), but some trees stopped at only 2-levels (e.g., 4*3) or 3-levels (4*3*2). Then I saw the partial-factorial was a function of SlotsOpen (e.g., if there were 4 slots open it'd be 4*3*2..., 5 slotsOpen would be 5*4*3...), and the tree-depth was a function of # of SlowerCars (2 slowerCars=depth of 2, so for 4: 4*3, for 5: 5*4, etc). Then that gives a very simple way to compute the number of nodes with just the number of SlotsOpen & SlowerCars, all I need.

 

After all that, I saw it was undercounting some examples. Then I realized you also have to account for different arrangements of the faster cars (e.g., the example I gave above, x-x-[3]-6-4-5 has two total arrangements with the faster cars 1-2-[3]-6-4-5 & 2-1-[3]-6-4-5). So you just have to multiply the answer by all the fastercar arrangements, which is just FasterCar! (in that case 2!). So still very simple.

 

 

 

Edit2: Ok, If I were to venture something that looks like an equation...

 

 

... I can just directly translate the algorithm.

 

Average =

 

n! + (n-1)(n-1)! + Sum(i=2 to (n-1))[ Sum(j=2 to i){ [ {Product, k=0 to (n-i-1)}(n-j-k) ] * (i-1)! } ]

-------------------------------------------------------------------------------------------------------

n!

 

And happily it's a function of n.

So there's my equation. Yay.

 

I drew it out to see it better:

219554o.jpg

 

 

 

Edit3: I found a bug in the system. Does anyone want to help me fix it?

 

 

So I hit a snag after checking my equation against examples. It works as I intended, it's just that "as intended" doesn't always get the right answer. Starting with n(4) it starts undercounting! When I looked at what was going on by hand, I realized the [(n-j)-(n-i)!] part was cutting out valid chunks. It was right to "cut out" the tree by one level (there were 2 open spots, but only 1 SlowerCar going in them, so we didn't have to "fill all the spots" with different cars, thus, there's not 2! routes to the tree-top, only 2.), so it worked "as intended", but I missed a big flaw in my logic.

 

The easy way to explain it is comparing an example where it works & where it doesn't. E.g., for the example 5!, if you wanted that to only go to 2 levels (2 cars in 5 slots), that is we only want 5*4=20 arrangements, then 5!-3! (that is 1*2*3*4*5 - 1*2*3) = the right answer; we only have the 5*4 left. BUT for 2! this method fails to do what I want. In an example where we only want it to go 1 level (1 car in 2 slots), we want "2" by itself (with no "*1" following it, i.e., 2 arrangements). But in this case, 2!-1! (1*2 - 1) gives the wrong answer, "1" when we want "2".

 

Long story short, the equation is actually working like it's supposed to, but I goofed on translating the logic into a mathmatical form that doesn't always perform like I want it to. So... Looks like I need to either (1) keep the method & fix this one case where (n-1)!=1, (in every other case >1 subtracting it should work), or (2) find another method to do the job I want. I just fear another method won't be as short & clean. (Or 3, as I did in my first version, just define a new function to do what I want by definition.)

 

Anybody have any ideas how I can get the answer I want? That is, I want to do factorials to "levels", 5! to 2 levels="5*4", 3! to 2 levels="3*2", 2! to one level="2", etc. In a previous answer I actually defined a new function called "partial factorial" (P!) that was like yP!(x), where y=SlotsOpen(factorial) and x=SlowerCars(levels deep), so 5 slots open for 3 slower cars = "5P!(3)" = 5*4*3 = 60 arrangements. Does anybody have ideas for a method to do this, or am I better just defining a new function by hand like this?

 

(A related issue is that my equation wants 0!=0, while the mathmatical definition is "1". The difference of course is that the math is thinking of "0" as a set in itself. But the puzzle doesn't care if there's "1" arrangement of "no cars"; all it cares about is that there are no cars to arrange, lol. If I went with yP!(x) this would be part of its definition.) Ugh, see this is why I'm usually better thinking in terms of programming than pure math. With programming you just translate real world logic to a direct virtual counterpart. With math you're translating real world logic into a this purified formal language that doesn't always care about the real world, heh.

 

 

 

Edit4, fixed the bug.

 

Ok, fixed the bug. I just needed to learn the Product variation of Sum, capital Pi. That does the job directly. I'm sure I learned about it ages ago, but I had to guess it existed and look it up to find it again.

 

Now instead of [ (n-j)! - {(n-j)-(n-i)}! ] it's [ {Product, k=0 to (n-i-1)}(n-j-k) ]

So for n=7 when i=4(car),j=3(place), that'd look like 4*3*2=24, which is right.

And for the bug I was getting at n=4, i=3, j=2, that's look like 2*{no rounds}=2, also right.

I'll correct my previous answers.

 

 

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

interesting code, demagogue, i wrote something similar (in R):

 

 

countClumps=function(N)

{

 

carVect=vector(length=N)

allPerms=permutations(N,N)

clumpTotals=vector(length=factorial(N))

for(i in 1:factorial(N))

{

carVect=allPerms[i,]

clumpCount=N

for(j in 2:N)

{

if(carVect[j]<carVect[j-1])

{

carVect[j]=carVect[j-1]

clumpCount=clumpCount-1

}

}

 

clumpTotals=clumpCount

 

}

return(clumpTotals)

}

 

 

@Demagogue: only read this if you want a subtle hint:

 

try plotting the first 10 expectations, and see if it resembles a commonly used continuous function. this might give you some insight into what the pattern is. it's much more simple than you might think.

 

 

@PranQster:

 

there is an a countably infinite set of uncountably infinite sets that satisfy the condition. You need to describe all of them :-)

 

Milestones approaching:

Recital: 3-24-12

ToughMudder: 4-15-12

Release first FM: ?-?-20??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...