Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #16103

Re: Another little puzzle

From "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups comp.programming
Subject Re: Another little puzzle
Date 2022-12-21 15:15 +0100
Organization Aioe.org NNTP Server
Message-ID <tnv4eu$13i8$1@gioia.aioe.org> (permalink)
References <puzzle-20221214131815@ram.dialup.fu-berlin.de> <algorithm-20221221130021@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 2022-12-21 13:03, Stefan Ram wrote:

>    There were not enough tests written and run. As a result,
>    the puzzle has not yet been solved (unless I have overlooked
>    a contribution or misworded expectations).
> 
>    So, here are two possible test cases.
> 
> average( 23.5,  1.5 )==  0.5

Nope, it is 12.5! (:-))

Well, assuming that time samples can cross the day boundary and assuming 
that averaged time is defined as averaging duration from some epoch and 
adding the epoch back:

    Avr({Ti}) =def= Avr({Ti}-E) + E

(you cannot average time as it is).

Then in the case of n = 2 you have two competing answers:

    (23.5 + n * 24 + 1.5 + m * 24) / 2 (mod 24)

where n and m are any natural numbers (specifying the day). This 
resolves to:

    12.5 + (n + m) * 12 (mod 24)

which gives either 12.5 or 0.5 depending on whether n + m is odd or even.

Now the fun part is that when n contains factors other than 2 or 3 
(24=2*2*2*3) then there might be up to 23 different answers!

Your puzzle is ill specified.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Back to comp.programming | Previous | Next | Find similar


Thread

Re: Another little puzzle "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2022-12-21 15:15 +0100

csiph-web