Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,29 @@
use strict;
use warnings;
use feature 'say';
sub evil {
my $i = 0;
sub { $i++ while population_count($i) % 2; $i++ }
}
sub odious {
my $i = 0;
sub { $i++ until population_count($i) % 2; $i++ }
}
sub population_count {
my $n = shift;
my $c;
for ($c = 0; $n; $n >>= 1) { $c += $n & 1 }
$c
}
say join ' ', map { population_count 3**$_ } 0 .. 30 - 1;
my (@evil, @odious);
my ($evil, $odious) = (evil, odious);
push( @evil, $evil->() ), push @odious, $odious->() for 1 .. 30;
say "Evil @evil";
say "Odious @odious";

View file

@ -0,0 +1 @@
say unpack("%b*",pack "J*", 1234567); # J = UV

View file

@ -0,0 +1,11 @@
use ntheory qw/hammingweight/;
say hammingweight(1234567);
use Math::GMPz qw/Rmpz_popcount/;
say Rmpz_popcount(Math::GMPz->new(1234567));
use Math::BigInt;
say 0 + (Math::BigInt->new(1234567)->as_bin() =~ tr/1//);
use Bit::Vector;
say Bit::Vector->new_Dec(64,1234567)->Norm;