Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: How to do popcount (aka Hamming weight) in Perl

by danaj (Friar)
on Sep 26, 2017 at 17:04 UTC ( #1200134=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Math::BigInt;
    my $n = "16" x 1000;
    say 0 + (Math::BigInt->new("$n")->as_bin() =~ tr/1//);
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-05-28 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?