Re: probability puzzle



Phil Carmody <thefatphil_demunged@xxxxxxxxxxx> wrote:
An even better place to look would be Plouffe's Inverter:

Ooh, excellent, thank you. I was just saying to a friend that there
ought to be a website like that.

(`... and what's the use of sitting around telling my friends there
ought to be a website like that, if this guy just goes and gives you
its bleeding URL the next morning?' ;-)

Still doesn't recognise the number, but by this point I don't think
I really expected it to.

a = [K*2, K] + a[:n-1] + [a[n-1] + 4*a[n]]
Hmmm, evidently I don't grok python well enough yet.

It's difficult to know from that which bit you don't understand, so
I'll just explain everything I can think of and hope I hit it. This
constructs a new array by concatenating three old ones:

[K*2, K] = a two-element array containing K*2 and then K (fairly obviously)

a[:n-1] = an array consisting of the first n-1 elements of a. The
absent index before the colon indicates `start at the
beginning' (I could have explicitly written a[0:n-1] and
got the same effect), and the index after the colon
indicates `stop at position n-1'. In Python expressions
of this type, the indices indicate positions _between_
elements, not elements themselves, so that the question
of inclusive or exclusive doesn't arise, and a[m:n]
always has n-m elements (assuming 0 <= m <= n < len(a)).

[a[n-1] + 4*a[n]] = a one-element array containing that value.

Thus, the result is an array a' such that

a'[0] = K*2
a'[1] = K
a'[2] = a[0]
a'[3] = a[1]
...
a'[n] = a[n-2]
a'[n+1] = a[n-1] + 4*a[n]

which is what I described in my post (modulo confusion about whether
I was talking about the value of n before or after incrementing it).
Then we use that array as the new value of a, and increment n.
--
Simon Tatham "A defensive weapon is one with my finger on the
<anakin@xxxxxxxxx> trigger. An offensive weapon is one with yours."
.



Relevant Pages

  • Re: Laptop eyed for answers: Stepdad says sex-slayings suspect planned to start new life
    ... unremarkable personal website of a typical 20 year old. ... Mr. Marshall describes as "the sweetist pics of weapons that you ... Reisdorph, who was Mr. Marshall's best friend when they attended high ...
    (alt.true-crime)
  • Re: How Does One Get Hacked?
    ... another friend was hacked just this morning, ... Dont write them down, and dont tell anyone. ... website that requests is, make sure the website starts with https:// ... authenticator. ...
    (alt.games.warcraft)
  • Re: Upgrading IE 5.1 Safely
    ... I subscribe to a business website and keep some personal ... Have your friend take his machine to a qualified professional computer ... Win98 that might be the case, ...
    (microsoft.public.windowsxp.general)
  • Re: 80004005
    ... "John" wrote in message ... >> While the message does indicate an issue with the website, ... >> Backup is a PC User's Best Friend ...
    (microsoft.public.windowsxp.accessibility)
  • Re: DOS ATTACK
    ... >I have a friend that has a DOS Attack going on against their website. ... Add some Javascript to your page to break out of the frame. ...
    (Incidents)