Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: prime factorization using base 1

by clemburg (Curate)
on Jan 17, 2001 at 14:46 UTC ( #52486=note: print w/replies, xml ) Need Help??

in reply to prime factorization using base 1

Our regex engine is truly The Little Engine That Could! Nice idea, tye. Going back to the fundamentals often pays ;-) ...

Here is something similar I worked out for a statistics module that needed tie-adjusted ranks (a "tie" occurs in a list of numbers if two numbers have exactly the same value - something that most statistics algorithms don't really like because it violates their assumptions about continuous distributions).

sub ties { my @val = sort @_; return () unless @val; my @delta = (1) x @val - 1; for (my $i = 1; $i < @val; $i++) { $delta[$i - 1] = $val[$i] - $val[$i - 1] ? 1 : 0; } my @ties = map {length} split /1+/, join '', @delta; shift @ties unless $ties[0]; return map {++$_} @ties; }

Christian Lemburg
Brainbench MVP for Perl

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://52486]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2018-01-22 05:33 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (231 votes). Check out past polls.