Welcome to the Monastery PerlMonks

### Re: (Golf) Minimizing the Bacon Number

by bjelli (Pilgrim)
 on May 15, 2001 at 02:35 UTC ( #80383=note: print w/replies, xml ) Need Help??

```sub b {
\$M = scalar keys %t;
...
}
\$sum;
}
```
```sub b{\$M=\$m=@_*@_;for(keys %t){\$r=c(\$_);(\$m,\$n)=(\$r,\$_)if(\$r<\$m)}\$n}su
+b c{%b=(\$_[0]=>\$b=\$sum=1);while(@_){\$b++;@_=grep{!\$b{\$_}}map{@{\$t{\$_}
+}}@_;@b{@_}=(\$b)x@_;\$sum+=\$b*@_;return\$M if\$sum>\$m}\$sum}
```
```sub b{\$M=\$m=@_*@_;for(keys %t){\$r=c(\$_);(\$m,\$n)=(\$r,\$_)if(\$r<\$m)}\$n}su
+b c{%b=(\$_[0]=>\$b=\$sum=1);while(@_){\$b++;@_=grep{!\$b{\$_}}map{@{\$t{\$_}
+}}@_;@b{@_}=(\$b)x@_;\$sum+=\$b*@_}\$sum}
```

Create A New User
Node Status?
node history
Node Type: note [id://80383]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2017-06-23 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (555 votes). Check out past polls.