Dijkstra (was Re: Source code to identify user through browser?)

Terry Jan Reedy tjreedy at udel.edu
Wed Jun 5 20:07:19 EDT 2013


On 6/5/2013 6:07 PM, Carlos Nepomuceno wrote:

> Didn't know he was such a humorist! lol
>
> Although I prefer when he's serious:
>
> http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1094.html

pythonic summary:
Let S be an finite iterable of numbers (make it not an iterable if one 
interprets the conclusion as requiring reiteration) and let n = len(S) 
(or len(list(S)) if need be). The if n > 2 and len(set(S)) > 1,
n * min(S) < sum(S) < max(S)  # easily shown by induction on n

If the n = 1 or the items in S are all the same,
n*min == sum == n*max

I might call this the 'Averages are not extreme' theorem.

Corollary: if min(s) == 1 and sum(S) > n, then max(S) > 1
'Pigeonhole Principle'

--
Terry Jan Reedy






More information about the Python-list mailing list