This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
/* Below this size, just sieve. */ | |
#define SIEVE_LIMIT 1000000 | |
/***************************************************************************** | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
package Acme::Math::ExampleSieves; | |
use warnings; | |
use strict; | |
# A simple example, showing some new prime sieves in Perl (all SoE). | |
# Copyright 2012 by Dana Jacobsen (dana@acm.org) | |
# This program is free software using the Perl 5 artistic license v2. | |
# Note, the string sieve will be 2x faster using Perl 5.16.0 or later. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
package Acme::Math::AKS; | |
use warnings; | |
use strict; | |
use Math::BigInt try => 'GMP'; | |
use Math::BigFloat try => 'GMP'; | |
# Technically we can get by without any of these functions | |
use Math::Prime::Util qw/primes next_prime euler_phi is_prob_prime/; | |
# A simple standalone Perl implementation of the AKS primality algorithm: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The Computer Language Benchmarks game | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by David Pyke | |
# tweaked by Danny Sauer | |
# optimized by Steffen Mueller | |
# tweaked by Kuang-che Wu | |
# optimized by Rodrigo de Oliveira | |
# modified by Dana Jacobsen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For package Data::BitStream. Perl 5.14.1, Moose 2.0202, Mouse 0.93, Moo 0.009011. | |
Steps to convert package from Mouse to Moose: | |
1. find . -type f|egrep '\.(t|pl|pm)$' | xargs perl -i -pe 's/Mouse/Moose/g' | |
Steps to convert from Mouse to Moo: | |
1. find . -type f|egrep '\.(t|pl|pm)$' | xargs perl -i -pe 's/Mouse/Moo/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
sub die_usage { die "Usage: -encode|-decode unary|gamma|delta|omega|fib\n"; } | |
use Getopt::Long; | |
my $emethod; | |
my $dmethod; | |
GetOptions('help|usage|?' => sub { die_usage() }, |