Hello Ton!
"Ton Hospel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yes, it violates rule 3. Rejecting this kind of programs is the
> actual reason why rule 3 exists.
>
> The "perfect computer" was introduced so that extremely long running
> programs don't have to worry about ha
In article <[EMAIL PROTECTED]>,
Juho Snellman <[EMAIL PROTECTED]> writes:
> On Thu, Jan 29, 2004 at 04:26:41PM -0600, J. Riley Bryant wrote:
>> Assuming that we are randomly creating solutions 1e6
>> times, what is the probablilty that we will come up
>> with all permutations for up to 8 in
In article <[EMAIL PROTECTED]>,
"J. Riley Bryant" <[EMAIL PROTECTED]> writes:
> Probability = PR(1,8,(1-(n!-1)/n!)^1e6)
>
> = (1-(0/1)^1e6) *
> (1-(1/2)^1e6) *
> (1-(5/6)^1e6) *
> (1-(23/24)^1e6) *
> (1-(119/120)^1e6) *
> (1-(719/720)^1e6) *
> (1-(5039/5040)^1e6) *
> (1-(4031
> (Please note that running time increasing
> dramatically as n increases, making the code only
> practical for n <= 4.)
>
> #!/usr/bin/perl -l
> sub f {$_[0]<2?$_[0]:$_[0]*f($_[0]-1)}
> sub g {
>$_[2]=$_[0]**$_[1];
>$_[2]-=(f($_[0])/(f($_[0]-$_)*f($_)))*g($_,$_[1])for 1..$_[0]-1;
>$_[
On Thursday 29 January 2004 10:26 pm, J. Riley Bryant wrote:
> Let PR(x,y,f(n)) be the Product of f(n) for x<=n<=y.
>
> Probability = PR(1,8,(1-(n!-1)/n!)^1e6)
>
> = (1-(0/1)^1e6) *
> (1-(1/2)^1e6) *
> (1-(5/6)^1e6) *
> (1-(23/24)^1e6) *
> (1-(119/120)^1e6) *
> (1-(719/720)^1e6) *
> (1
On Fri, Jan 30, 2004 at 02:57:32PM -0600, J. Riley Bryant wrote:
> % perl -le 'for (1..1e5) { $i = 0; $a[$i++][$_]++ for sort { rand 2 }
> 1..8}; print "@{$_}" for @a'
[...]
> % perl -le '@_=(1..8); for (1..1e5) {$i=0; $a[$i++][$_]++ for
> @_=sort{rand [EMAIL PROTECTED] print "@{$_}" for @a'
[...]
On Thu, Jan 29, 2004 at 04:26:41PM -0600, J. Riley Bryant wrote:
> Assuming that we are randomly creating solutions 1e6
> times, what is the probablilty that we will come up
> with all permutations for up to 8 input letters
> (assuming that the number of input letters is evenly
> likely to be any v
Hello Roie!
Thanks for the statistic help!
roiem wrote:
>> I think there's a bug in your f(n) =
>> 1-(n!-1)/n!^1e6: What you're saying is that
>> f(n) = 1-[probability of generating only n!-1
>> permutations, 1e6 times]. But that doesn't take
>> into account the choice you have to make, which
>>
Hello Riley!
[EMAIL PROTECTED] (J. Riley Bryant) wrote:
> My math is a bit rusty, so I wanted people to double-
> check any mistakes I may have made...
Looks like math is ok.
>= 0.988148537165638680164463
Yes, and probability of failure is less than 1e-107
for 1..1e7 loop.
> Now the p
Perl -e 'sub a{print+local$*=$*.shift,$/,a(@_)for(1)x@_};a(1..5)'
> I found this on the perl-beginner list:
> Perl -e
> '*,=sub{print+local$*=$*.$_[$_],$/,&,(@_[1+$_..$#_])for$#..$#_};&,(1..5)'
>
> By Paul Johnson, which isn't to shabby, but not really up to specs.
>
> Anyone?
Of course :)
Perl -e "sub a{print+local$*=$*.shift,$/,a(@_)for$#..$#_};a(1..3)"
Wlad
Tor Hildrum said:
> I found this on the perl-beginner list:
> Perl -e
> '*,=sub{print+local$*=$*.$_[$_],$/,&,(@_[1+$_..$#_])for$#..$#_};&,(1..5)'
>
> By Paul Johnson, which isn't to shabby, but not really up to specs.
At first I thought "What? I posted that to the _beginners_ list?", but
then I
In article <[EMAIL PROTECTED]>,
Eugene van der Pijll <[EMAIL PROTECTED]> writes:
> perl -lne'sub a{print+local$*=$*.shift,a(@_)for(1)x@_};a/./g'
>
> is the golf version. This one takes input from STDIN, as requested.
> Same output, different order:
>
> perl -Xlne'sub a{print+local$*=pop.$
En op 10 december 2002 sprak Eugene van der Pijll:
>
> perl -Xlne'sub a{print+local$*=pop.$*,a(@_)for(1)x@_};a/./g'
Errr, that semicolon wasn't there when I posted it. Honestly.
For some reason, none of these standard tricks work:
(-ugene
--
If you watch a game, it's fun. If you play at it, i
En op 10 december 2002 sprak Tor Hildrum:
> I'm currently at 200+ using a couple of nested for-loops and to much time,
> which is basically why I was curios what you guys could come up with.
>
> I found this on the perl-beginner list:
> Perl -e
> '*,=sub{print+local$*=$*.$_[$_],$/,&,(@_[1+$_..$#_
15 matches
Mail list logo