 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
clipka wrote:
> Warp schrieb:
>> 3) Assume two people, person A and person B, who want to decide who
>> gets
>> a price by tossing a coin.
>>
>> Person A is a bad loser and a bully, so if he loses he says "I said
>> it's
>> two out of three". So they play it like that. If A loses again, he says
>> "I said it's three out of five", and so on, until he wins.
>>
>> How many tosses is this game expected to last, in average?
>
> I think that very much depends on whether the sequence is
>
> 1 - 3 - 5 - 7 - 9 - ...
>
> or
>
> 1 - 3 - 5 - 9 - 17 - ...
>
>
I didn't look at the other puzzles, but this one sounds easy enough to
work with before sleep.
First round, A claims 'heads I win' so could win 50% of the time.
Each time B gets a tail flip, A increments how many are needed to win.
Best N out of 2N-1.
Okay, A stands to win first round 50% of the time.
Second round, A can not win because he obviously lost first round.
Third round, A has a remaining 50% chance to win if he won either
previous, a 0 if not.
Just going on brain alone, and barely any of that since it is late here.
But it seems that if the game progresses past the first round, it has a
high chance of going on forever. Same for any of the loss points after
that. Average of 1 + infinity is somewhat closer to infinity than to
one. I would say the game in unwinnable.
The other option is that Player B just needs to punch A, take the coin
and walk away. At least he wins a coin, this way.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> 4) By their nature, factorials tend to accumulate trailing zeroes. For
> example, 5! (120) has one trailing zero, 10! (3628800) has two trailing
> zeroes, 25! (15511210043330985984000000) has six trailing zeroes, etc.
>
> Give a (non-recursive) mathematical function which, for an integer n,
> gives the number of trailing zeroes in n!.
>
I think I have a numerical solution, but I do not have the formulas to
write the equation. Yet. . .
What you are interested in is the number of numbers, less than n, that
end in 5, or 0. Five times any even number will result in a multiple of
10 and have add zero at the end. All factorials after 2! are even, given
that 2 is even and they are all multiplied by 2 by recursion.
So, to solve for the number of integers that are multiples of 10, X =
floor(N/10), but save the remainder of N/10 as R. Y, the number of
integers <N ending in 5s, can be gotten via R. Y = floor(R/5)+X. Number
of zeros would be X + Y.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 09/22/09 15:44, clipka wrote:
> Thus, the number of trailing zeros can be expressed as:
>
> floor(n/5) + floor (n/(5^2)) + floor(n/(5^3)) + ...
>
> which is a perfectly valid, non-recursive (albeit infinite) mathematical
> formula for the desired thing. (Unfortunately the floor() function
While he didn't state it in his original phrasing, he meant closed form.
--
I think animal testing is a terrible idea. They get all nervous and give
the wrong answers.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Neeum Zawan schrieb:
> On 09/22/09 15:44, clipka wrote:
>> Thus, the number of trailing zeros can be expressed as:
>>
>> floor(n/5) + floor (n/(5^2)) + floor(n/(5^3)) + ...
>>
>> which is a perfectly valid, non-recursive (albeit infinite) mathematical
>> formula for the desired thing. (Unfortunately the floor() function
>
> While he didn't state it in his original phrasing, he meant closed
> form.
This being a mathematical puzzle, I'm adhering to the /definition/, not
the /intention/ :-P
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
andrel <a_l### [at] hotmail com> wrote:
> >> 8 is less than 24
> >
> > So? How does that answer the question?
> that is obvious, I would think.
Care to explain? It's not obvious to me.
> Ok I read that wrong. Can you give an algorithm for 'and so on'?
"I said it's <n> of <n*2-1>" with consecutive values of n.
> No it has 2 both 10 and 5 have a factor of 5. So if you want your
> algorithm:
> sum_k floor(x/(5^k)) over all k from 1 till 5^k<=x
But I want a closed-form function, not a recursive function or summation.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Neeum Zawan <m.n### [at] ieee org> wrote:
> On 09/22/09 15:44, clipka wrote:
> > Thus, the number of trailing zeros can be expressed as:
> >
> > floor(n/5) + floor (n/(5^2)) + floor(n/(5^3)) + ...
> >
> > which is a perfectly valid, non-recursive (albeit infinite) mathematical
> > formula for the desired thing. (Unfortunately the floor() function
> While he didn't state it in his original phrasing, he meant closed form.
If we allow recursive functions, then the simplest answer would be:
f(0) = 0
f(n) = floor(n/5) + f(floor(n/5))
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
clipka <ano### [at] anonymous org> wrote:
> > 3) Assume two people, person A and person B, who want to decide who gets
> > a price by tossing a coin.
> >
> > Person A is a bad loser and a bully, so if he loses he says "I said it's
> > two out of three". So they play it like that. If A loses again, he says
> > "I said it's three out of five", and so on, until he wins.
> >
> > How many tosses is this game expected to last, in average?
> I think that very much depends on whether the sequence is
> 1 - 3 - 5 - 7 - 9 - ...
> or
> 1 - 3 - 5 - 9 - 17 - ...
How would "four out of nine" work? If there are nine tosses, four wins
wouldn't yet be decisive.
Of course it's "4 out of 7", "5 out of 9", "6 out of 11" and so on.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 23-9-2009 21:02, Warp wrote:
> andrel <a_l### [at] hotmail com> wrote:
>>>> 8 is less than 24
>>> So? How does that answer the question?
>
>> that is obvious, I would think.
>
> Care to explain? It's not obvious to me.
See Tim Cook.
>> Ok I read that wrong. Can you give an algorithm for 'and so on'?
>
> "I said it's <n> of <n*2-1>" with consecutive values of n.
where? This formula does not match your problem for n=1.
Strange bully to incrementally decrease his changes.
Or am I still not getting it?
>> No it has 2 both 10 and 5 have a factor of 5. So if you want your
>> algorithm:
>> sum_k floor(x/(5^k)) over all k from 1 till 5^k<=x
>
> But I want a closed-form function, not a recursive function or summation.
>
you said you didn't want a recursive function. You never said anything
about summations.
I am afraid we enter into a semantic discussion here, where I might take
another POV than you about what is a closed-form. I'll for the moment
assume that you had stated it as you have now modified it and think again.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 23-9-2009 22:22, andrel wrote:
> On 23-9-2009 21:02, Warp wrote:
>> andrel <a_l### [at] hotmail com> wrote:
>
>>> Ok I read that wrong. Can you give an algorithm for 'and so on'?
>>
>> "I said it's <n> of <n*2-1>" with consecutive values of n.
>
> where? This formula does not match your problem for n=1.
> Strange bully to incrementally decrease his changes.
> Or am I still not getting it?
Am was indeed not getting it.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
andrel <a_l### [at] hotmail com> wrote:
> > "I said it's <n> of <n*2-1>" with consecutive values of n.
> where? This formula does not match your problem for n=1.
> Strange bully to incrementally decrease his changes.
> Or am I still not getting it?
The game starts with "1 out of 2" (regular coin toss). But if the bully
loses, he declares "I said it's 2 out of 3" and the game continues. If he
loses again, he declares "I said it's 3 out of 5", and so on.
In general, when he loses the n'th time, he declares "I said it's <n+1>
out of <(n+1)*2-1>".
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |