Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Problems? Is your data what you think it is?
 
PerlMonks  

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
http://www.brainbench.com


Comment on Re: prime factorization using base 1
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://52486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-04-21 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls