* Re: math problem: 28, 39, and 55 days
[not found] ` <8bbb0aaa-a1f4-4698-8b5f-9787e44735ca@googlegroups.com>
@ 2018-01-19 2:26 ` Emanuel Berg
0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2018-01-19 2:26 UTC (permalink / raw)
To: help-gnu-emacs
darrellhicks450 wrote:
>> The first Survivor ever, in Sweden, was only
>> 28 days. (Later it was extended to 40.)
>>
>> Today's US Survivor is 39.
>>
>> Australian S04 was 55!
>>
>> If we define the difficulty of surviving day
>> x as a function of the number of days
>> preceeding it, i.e.
>>
>> 1, 2 ... (x - 1)
>>
>> then how much more difficult is it to
>> survive/complete Australian Survivor than
>> the US version, and the original
>> Swedish version?
>
> 55 days is approximately 40% longer than
> 39 days.
>
> I would estimate difficulty exceeds 40%‼️
>
> 55 days is 💯% longer than 28 days IOW A LOT
> HARDER‼️
Intuition: pass
Math: fail
:)
I redefined the problem just a bit so that at
day x, that day will also count, i.e. +x, as
otherwise, day 1 will have a zero cost.
Anyway here (last in the post) is some
Lisp (Elisp) to do the computation. The answer,
if the software is correct, is:
;; Australia vs USA: 197%
;; Australia vs Sweden: 379%
That is, the AU version is almost twice as
difficult as the US one, which corresponds to
my intuition as well.
(require 'cl-lib)
;; naive first attempt
;; (that does work)
(defun cost-at-day-loop (day)
(let ((cost 0)
(n 0) )
(cl-loop for n from 0 upto day do
(cl-incf cost n) )
cost) )
;; example: 5 -> (+ 1 2 3 4 5) = 15
;; testing:
;; (cost-at-day-loop 5) ; 15
;; (cost-at-day-loop 1) ; 1
;; (cost-at-day-loop 0) ; 0
;; better second attempt
(defun cost-at-day (day)
(apply #'+ (number-sequence 1 day)) )
;; testing:
;; (cost-at-day 5) ; 15
;; (cost-at-day 1) ; 1
;; (cost-at-day 0) ; 0
;; compute difficulty
(defun compare-difficulty ()
(let*((au (cost-at-day 55)) ; 1540
(us (cost-at-day 39)) ; 780
(se (cost-at-day 28)) ; 406
(au-vs-us (* (/ au (* us 1.0)) 100))
(au-vs-se (* (/ au (* se 1.0)) 100))
(au-vs-us-str (format "\n\n;; Australia vs USA: %.0f%%\n" au-vs-us))
(au-vs-se-str (format ";; Australia vs Sweden: %.0f%%\n" au-vs-se)) )
(insert au-vs-us-str)
(insert au-vs-se-str) ))
;; (compare-difficulty)
;; Australia vs USA: 197%
;; Australia vs Sweden: 379%
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] only message in thread