summaryrefslogtreecommitdiffstats
path: root/029-slow.pl
diff options
context:
space:
mode:
Diffstat (limited to '029-slow.pl')
-rwxr-xr-x029-slow.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/029-slow.pl b/029-slow.pl
new file mode 100755
index 0000000..8f36b00
--- /dev/null
+++ b/029-slow.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use 5.010;
+use List::MoreUtils qw/uniq/;
+
+my $n = $ARGV[0];
+
+my @list;
+my %list;
+for my $a (2..$n) {
+ for my $b (2..$n) {
+ my $pow = `echo '$a^$b' | bc`;
+ chomp $pow;
+ #push @{ $list{$pow} ||= [] }, [$a, $b];
+ push @list, $pow;
+ }
+ #say $a;
+}
+#for my $val (keys %list) {
+ #next unless @{ $list{$val} } > 1;
+ #say join ' == ', map { "$_->[0]^$_->[1]" } @{ $list{$val} };
+#}
+say scalar uniq sort @list;