all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: math problem: 28, 39, and 55 days
Date: Fri, 19 Jan 2018 03:26:31 +0100	[thread overview]
Message-ID: <86fu724m94.fsf@zoho.com> (raw)
In-Reply-To: 8bbb0aaa-a1f4-4698-8b5f-9787e44735ca@googlegroups.com

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


           reply	other threads:[~2018-01-19  2:26 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <8bbb0aaa-a1f4-4698-8b5f-9787e44735ca@googlegroups.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fu724m94.fsf@zoho.com \
    --to=moasen@zoho.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.