aboutsummaryrefslogtreecommitdiff
path: root/challenge-169
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2022-06-20 06:38:34 +0100
committerdrbaggy <js5@sanger.ac.uk>2022-06-20 06:38:34 +0100
commitcf74c017563b79bd9e1cceb10990bf13e40125f7 (patch)
tree2d4ab159f92f5651a4e6fd3262e259adec31040e /challenge-169
parent26e9c6ce6f6f1815334d8a6e6599644b5196c7ac (diff)
parentb13601bf76ae50a91eae332a5faf08c99ad6300f (diff)
downloadperlweeklychallenge-club-cf74c017563b79bd9e1cceb10990bf13e40125f7.tar.gz
perlweeklychallenge-club-cf74c017563b79bd9e1cceb10990bf13e40125f7.tar.bz2
perlweeklychallenge-club-cf74c017563b79bd9e1cceb10990bf13e40125f7.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-169')
-rwxr-xr-xchallenge-169/2colours/raku/ch-1.raku19
-rwxr-xr-xchallenge-169/2colours/raku/ch-2.raku20
-rw-r--r--challenge-169/adam-russell/blog.txt1
-rw-r--r--challenge-169/adam-russell/blog1.txt1
-rw-r--r--challenge-169/adam-russell/java/ch-1.java44
-rw-r--r--challenge-169/adam-russell/java/ch-2.java54
-rw-r--r--challenge-169/adam-russell/perl/ch-1.pl38
-rw-r--r--challenge-169/adam-russell/perl/ch-2.pl48
-rw-r--r--challenge-169/adam-russell/prolog/ch-1.p40
-rw-r--r--challenge-169/adam-russell/prolog/ch-2.p51
-rw-r--r--challenge-169/arne-sommer/blog.txt1
-rwxr-xr-xchallenge-169/arne-sommer/perl/achilles-numbers-perl105
-rwxr-xr-xchallenge-169/arne-sommer/perl/brilliant-numbers-perl53
-rwxr-xr-xchallenge-169/arne-sommer/perl/ch-1.pl53
-rwxr-xr-xchallenge-169/arne-sommer/perl/ch-2.pl105
-rwxr-xr-xchallenge-169/arne-sommer/raku/achilles-numbers92
-rwxr-xr-xchallenge-169/arne-sommer/raku/brilliant-numbers34
-rwxr-xr-xchallenge-169/arne-sommer/raku/ch-1.raku34
-rwxr-xr-xchallenge-169/arne-sommer/raku/ch-2.raku92
-rwxr-xr-xchallenge-169/colin-crain/perl/ch-1.pl113
-rwxr-xr-xchallenge-169/colin-crain/perl/ch-2.pl139
-rw-r--r--challenge-169/duncan-c-white/README67
-rw-r--r--challenge-169/duncan-c-white/perl/PrimeFactors.pm63
-rwxr-xr-xchallenge-169/duncan-c-white/perl/ch-1.pl55
-rwxr-xr-xchallenge-169/duncan-c-white/perl/ch-2.pl100
-rw-r--r--challenge-169/habere-et-dispetire/raku/ch-1.raku9
-rw-r--r--challenge-169/habere-et-dispetire/raku/ch-2.raku11
-rw-r--r--challenge-169/jaldhar-h-vyas/blog.txt1
-rwxr-xr-xchallenge-169/jaldhar-h-vyas/perl/ch-1.pl39
-rwxr-xr-xchallenge-169/jaldhar-h-vyas/perl/ch-2.pl68
-rwxr-xr-xchallenge-169/jaldhar-h-vyas/raku/ch-1.raku40
-rwxr-xr-xchallenge-169/jaldhar-h-vyas/raku/ch-2.raku47
-rwxr-xr-xchallenge-169/mattneleigh/perl/ch-1.pl147
-rwxr-xr-xchallenge-169/mattneleigh/perl/ch-2.pl261
-rwxr-xr-xchallenge-169/perlboy1967/perl/ch-1.pl51
-rw-r--r--challenge-169/pokgopun/go/achilles/achilles.go137
-rw-r--r--challenge-169/pokgopun/go/achilles/achilles_test.go11
-rw-r--r--challenge-169/pokgopun/go/brilliant/brilliant.go98
-rw-r--r--challenge-169/pokgopun/go/brilliant/brilliant_test.go11
-rw-r--r--challenge-169/pokgopun/go/ch-1.go84
-rw-r--r--challenge-169/pokgopun/go/ch-2.go124
-rwxr-xr-xchallenge-169/rick-bychowski/ch-1.raku44
-rwxr-xr-xchallenge-169/rick-bychowski/ch-2.raku78
-rw-r--r--challenge-169/wambash/raku/ch-1.raku25
-rw-r--r--challenge-169/wambash/raku/ch-2.raku25
45 files changed, 2495 insertions, 238 deletions
diff --git a/challenge-169/2colours/raku/ch-1.raku b/challenge-169/2colours/raku/ch-1.raku
new file mode 100755
index 0000000000..a17ab34df7
--- /dev/null
+++ b/challenge-169/2colours/raku/ch-1.raku
@@ -0,0 +1,19 @@
+#!/usr/bin/env raku
+
+
+my @primes = grep &is-prime, ^Inf;
+my @primes-digited = @primes.map( -> $current {
+ state @buffer;
+ when @buffer[0] andthen .chars == $current.chars {
+ @buffer.append: $current;
+ Empty
+ }
+ my @res = @buffer;
+ @buffer = [$current];
+ @res
+});
+@primes-digited .= skip;
+@primes-digited.map({ ([\,] @$_) >>*>> @$_ andthen .flat.sort.Slip })
+ andthen .head: 20
+ andthen .join: ', '
+ andthen .say;
diff --git a/challenge-169/2colours/raku/ch-2.raku b/challenge-169/2colours/raku/ch-2.raku
new file mode 100755
index 0000000000..1fa0bc027d
--- /dev/null
+++ b/challenge-169/2colours/raku/ch-2.raku
@@ -0,0 +1,20 @@
+#!/usr/bin/env raku
+
+sub is-achilles($num) {
+ (powerful-exponent($num) // 0) == 1
+}
+
+multi powerful-exponent(1 --> 0) {}
+multi powerful-exponent($ where *.is-prime --> Nil) {}
+multi powerful-exponent($num) {
+ my $first-divisor = (2 .. *).first: $num %% *;
+ my $first-exponent = (1 .. *).toggle($num %% $first-divisor ** *).tail;
+ return Nil if $first-exponent == 1;
+ return $first-exponent gcd $_ with powerful-exponent($num div $first-divisor ** $first-exponent);
+ Nil
+}
+
+(1 .. *).grep: &is-achilles
+ andthen .head: 20
+ andthen .join: ', '
+ andthen .say; \ No newline at end of file
diff --git a/challenge-169/adam-russell/blog.txt b/challenge-169/adam-russell/blog.txt
new file mode 100644
index 0000000000..20b7acb63a
--- /dev/null
+++ b/challenge-169/adam-russell/blog.txt
@@ -0,0 +1 @@
+http://www.rabbitfarm.com/cgi-bin/blosxom/perl/2022/06/19 \ No newline at end of file
diff --git a/challenge-169/adam-russell/blog1.txt b/challenge-169/adam-russell/blog1.txt
new file mode 100644
index 0000000000..5b466f5717
--- /dev/null
+++ b/challenge-169/adam-russell/blog1.txt
@@ -0,0 +1 @@
+http://www.rabbitfarm.com/cgi-bin/blosxom/prolog/2022/06/19 \ No newline at end of file
diff --git a/challenge-169/adam-russell/java/ch-1.java b/challenge-169/adam-russell/java/ch-1.java
new file mode 100644
index 0000000000..09cdd62612
--- /dev/null
+++ b/challenge-169/adam-russell/java/ch-1.java
@@ -0,0 +1,44 @@
+import java.util.ArrayList;
+
+class Brilliant{
+ private static ArrayList primeFactors(long n){
+ ArrayList factors = new ArrayList();
+ while (n % 2 == 0){
+ factors.add(new Long(2));
+ n = n / 2;
+ }
+ for(long i = 3; i <= Math.sqrt(n); i = i + 2){
+ while (n % i == 0){
+ factors.add(new Long(i));
+ n = n / i;
+ }
+ }
+ if(n > 2)
+ factors.add(new Long(n));
+ return factors;
+ }
+
+ private static boolean isBrilliant(int n){
+ ArrayList factors = primeFactors(n);
+ return factors.size() == 2 && ((Long)factors.get(0)).toString().length() == ((Long)factors.get(1)).toString().length();
+ }
+
+ public static ArrayList nBrilliants(int n){
+ ArrayList brilliants = new ArrayList();
+ int i = 0;
+ do{
+ i++;
+ if(isBrilliant(i))
+ brilliants.add(new Integer(i));
+ }while(brilliants.size() < n);
+ return brilliants;
+ }
+
+ public static void main(String[] args){
+ ArrayList brilliants = Brilliant.nBrilliants(20);
+ for(int i = 0; i < brilliants.size() - 1; i++){
+ System.out.print(brilliants.get(i) + ", ");
+ }
+ System.out.println(brilliants.get(brilliants.size() - 1));
+ }
+} \ No newline at end of file
diff --git a/challenge-169/adam-russell/java/ch-2.java b/challenge-169/adam-russell/java/ch-2.java
new file mode 100644
index 0000000000..47c8d7813e
--- /dev/null
+++ b/challenge-169/adam-russell/java/ch-2.java
@@ -0,0 +1,54 @@
+import java.util.ArrayList;
+
+class Achilles{
+ private static final double EPSILON = 1e-15;
+ private static ArrayList primeFactors(long n){
+ ArrayList factors = new ArrayList();
+ while (n % 2 == 0){
+ factors.add(new Long(2));
+ n = n / 2;
+ }
+ for(long i = 3; i <= Math.sqrt(n); i = i + 2){
+ while (n % i == 0){
+ factors.add(new Long(i));
+ n = n / i;
+ }
+ }
+ if(n > 2)
+ factors.add(new Long(n));
+ return factors;
+ }
+
+ private static boolean isAchilles(int n){
+ ArrayList factors = primeFactors(n);
+ for(int i = 0; i < factors.size(); i++){
+ if(n % Math.pow(((Long)factors.get(i)).longValue() + 0.0, 2) != 0)
+ return false;
+ }
+ for(int i = 2; i <= Math.sqrt(n); i++) {
+ double d = Math.log(n) / Math.log(i);
+ if(Math.abs(d - Math.round(d)) < EPSILON)
+ return false;
+ }
+ return true;
+ }
+
+ public static ArrayList nAchilles(int n){
+ ArrayList achilles = new ArrayList();
+ int i = 1;
+ do{
+ i++;
+ if(isAchilles(i))
+ achilles.add(new Integer(i));
+ }while(achilles.size() < n);
+ return achilles;
+ }
+
+ public static void main(String[] args){
+ ArrayList achilles = Achilles.nAchilles(20);
+ for(int i = 0; i < achilles.size() - 1; i++){
+ System.out.print(achilles.get(i) + ", ");
+ }
+ System.out.println(achilles.get(achilles.size() - 1));
+ }
+} \ No newline at end of file
diff --git a/challenge-169/adam-russell/perl/ch-1.pl b/challenge-169/adam-russell/perl/ch-1.pl
new file mode 100644
index 0000000000..4f7367e9d2
--- /dev/null
+++ b/challenge-169/adam-russell/perl/ch-1.pl
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+##
+# Write a script to generate the first 20 Brilliant Numbers.
+##
+sub prime_factor{
+ my $x = shift(@_);
+ my @factors;
+ for (my $y = 2; $y <= $x; $y++){
+ next if $x % $y;
+ $x /= $y;
+ push @factors, $y;
+ redo;
+ }
+ return @factors;
+}
+
+sub is_brilliant{
+ my($n) = @_;
+ my @factors = prime_factor($n);
+ return @factors == 2 && length($factors[0]) == length($factors[1]);
+}
+
+sub n_brilliants{
+ my($n) = @_;
+ my @brilliants;
+ my $i = 0;
+ {
+ push @brilliants, $i if is_brilliant($i);
+ $i++;
+ redo if @brilliants < $n;
+ }
+ return @brilliants;
+}
+
+MAIN:{
+ print join(", ", n_brilliants(20)) . "\n";
+} \ No newline at end of file
diff --git a/challenge-169/adam-russell/perl/ch-2.pl b/challenge-169/adam-russell/perl/ch-2.pl
new file mode 100644
index 0000000000..d677bc6c27
--- /dev/null
+++ b/challenge-169/adam-russell/perl/ch-2.pl
@@ -0,0 +1,48 @@
+use strict;
+use warnings;
+##
+# Write a script to generate the first 20 Achilles Numbers.
+##
+use POSIX;
+use boolean;
+
+sub prime_factor{
+ my $x = shift(@_);
+ my @factors;
+ for (my $y = 2; $y <= $x; $y++){
+ next if $x % $y;
+ $x /= $y;
+ push @factors, $y;
+ redo;
+ }
+ return @factors;
+}
+
+sub is_achilles{
+ my($n) = @_;
+ my @factors = prime_factor($n);
+ for my $factor (@factors){
+ return false if $n % ($factor * $factor) != 0;
+ }
+ for(my $i = 2; $i <= sqrt($n); $i++) {
+ my $d = log($n) / log($i) . "";
+ return false if ceil($d) == floor($d);
+ }
+ return true;
+}
+
+sub n_achilles{
+ my($n) = @_;
+ my @achilles;
+ my $i = 1;
+ {
+ $i++;
+ push @achilles, $i if is_achilles($i);
+ redo if @achilles < $n;
+ }
+ return @achilles;
+}
+
+MAIN:{
+ print join(", ", n_achilles(20)) . "\n";
+} \ No newline at end of file
diff --git a/challenge-169/adam-russell/prolog/ch-1.p b/challenge-169/adam-russell/prolog/ch-1.p
new file mode 100644
index 0000000000..e360089652
--- /dev/null
+++ b/challenge-169/adam-russell/prolog/ch-1.p
@@ -0,0 +1,40 @@
+prime_factors(N, L):-
+ N > 0,
+ prime_factors(N, L, 2).
+prime_factors(1, [], _):-
+ !.
+prime_factors(N, [F|L], F):-
+ R is N // F,
+ N =:= R * F,
+ !,
+ prime_factors(R, L, F).
+prime_factors(N, L, F):-
+ next_factor(N, F, NF),
+ prime_factors(N, L, NF).
+next_factor(_, 2, 3):-
+ !.
+next_factor(N, F, NF):-
+ F * F < N,
+ !,
+ NF is F + 2.
+next_factor(N, _, N).
+
+brilliants(_) --> [].
+brilliants(Seen) --> [X], {brilliant(X), \+ member(X, Seen)}, brilliants([X|Seen]).
+
+brilliant(X):-
+ current_prolog_flag(max_integer, MAX_INTEGER),
+ between(1, MAX_INTEGER, X),
+ prime_factors(X, Factors),
+ length(Factors, 2),
+ nth(1, Factors, First),
+ nth(2, Factors, Second),
+ number_chars(First, FirstChars),
+ number_chars(Second, SecondChars),
+ length(FirstChars, FirstCharsLength),
+ length(SecondChars, SecondCharsLength),
+ FirstCharsLength == SecondCharsLength.
+
+n_brilliants(N, Brilliants):-
+ length(Brilliants, N),
+ phrase(brilliants([]), Brilliants). \ No newline at end of file
diff --git a/challenge-169/adam-russell/prolog/ch-2.p b/challenge-169/adam-russell/prolog/ch-2.p
new file mode 100644
index 0000000000..7d7a8585b1
--- /dev/null
+++ b/challenge-169/adam-russell/prolog/ch-2.p
@@ -0,0 +1,51 @@
+prime_factors(N, L):-
+ N > 0,
+ prime_factors(N, L, 2).
+prime_factors(1, [], _):-
+ !.
+prime_factors(N, [F|L], F):-
+ R is N // F,
+ N =:= R * F,
+ !,
+ prime_factors(R, L, F).
+prime_factors(N, L, F):-
+ next_factor(N, F, NF),
+ prime_factors(N, L, NF).
+next_factor(_, 2, 3):-
+ !.
+next_factor(N, F, NF):-
+ F * F < N,
+ !,
+ NF is F + 2.
+next_factor(N, _, N).
+
+powerful(N, X):-
+ M is mod(N, X * X),
+ M == 0.
+
+imperfect(N):-
+ Sqrt is round(sqrt(N)),
+ S is Sqrt - 1,
+ length(I, S),
+ fd_domain(I, 2, Sqrt),
+ fd_all_different(I),
+ fd_labeling(I),!,
+ maplist(imperfect(N), I).
+imperfect(N, X):-
+ D is log(N) / log(X),
+ Check is abs(D - round(D)),
+ \+ Check < 0.000001.
+
+achilles(_) --> [].
+achilles(Seen) --> [X], {current_prolog_flag(max_integer, MAX_INTEGER),
+ between(2, MAX_INTEGER, X), \+ member(X, Seen), achilles(X)},
+ achilles([X|Seen]).
+
+achilles(X):-
+ prime_factors(X, Factors),
+ maplist(powerful(X), Factors),
+ imperfect(X).
+
+n_achilles(N, Achilles):-
+ length(Achilles, N),
+ phrase(achilles([]), Achilles). \ No newline at end of file
diff --git a/challenge-169/arne-sommer/blog.txt b/challenge-169/arne-sommer/blog.txt
new file mode 100644
index 0000000000..b6072b4829
--- /dev/null
+++ b/challenge-169/arne-sommer/blog.txt
@@ -0,0 +1 @@
+https://raku-musings.com/ambundance-numbers.html
diff --git a/challenge-169/arne-sommer/perl/achilles-numbers-perl b/challenge-169/arne-sommer/perl/achilles-numbers-perl
new file mode 100755
index 0000000000..1a4c199378
--- /dev/null
+++ b/challenge-169/arne-sommer/perl/achilles-numbers-perl
@@ -0,0 +1,105 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+use feature 'signatures';
+no warnings 'experimental::signatures';
+
+use Math::Prime::Util 'is_prime';
+
+my $count = shift(@ARGV) || 20;
+
+die "Please specify a positive integer" unless $count =~ /^[1-9]\d*$/;
+
+my @achilles = ();
+
+my $candidate = 0;
+
+while (@achilles != $count)
+{
+ $candidate++;
+
+ push(@achilles, $candidate) if is_achilles($candidate);
+}
+
+say join(", ", @achilles);
+
+sub factors ($number)
+{
+ return (1) if $number == 1;
+ return ($number) if is_prime($number);
+
+ my @factors;
+
+ for my $candidate (grep { is_prime($_) } 2 .. $number / 2)
+ {
+ while ($number % $candidate == 0)
+ {
+ push(@factors, $candidate);
+ $number /= $candidate;
+ }
+ }
+
+ return @factors;
+}
+
+sub divisors ($number)
+{
+ my @divisors;
+
+ for my $candidate (2 .. $number/2)
+ {
+ push(@divisors, $candidate) if $number % $candidate == 0;
+ }
+
+ return @divisors;
+}
+
+sub is_powerful ($number)
+{
+ return 1 if $number == 1;
+
+ my @factors = factors($number);
+
+ my %values;
+
+ for my $val (@factors)
+ {
+ $values{$val}++;
+ }
+
+ for my $count (values %values)
+ {
+ return 0 if $count == 1;
+ }
+
+ return 1;
+}
+
+sub is_perfect ($number)
+{
+ return 1 if $number <= 1;
+
+ my @divisors = divisors($number);
+
+ return 0 unless @divisors;
+
+ for my $divisor (@divisors)
+ {
+ my $current = $divisor;
+
+ $current *= $divisor while $current < $number;
+
+ return 1 if $current == $number;
+ }
+
+ return 0;
+}
+
+sub is_achilles ($number)
+{
+ return 0 unless is_powerful($number);
+ return 0 if is_perfect($number);
+ return 1;
+}
diff --git a/challenge-169/arne-sommer/perl/brilliant-numbers-perl b/challenge-169/arne-sommer/perl/brilliant-numbers-perl
new file mode 100755
index 0000000000..5a6a78d790
--- /dev/null
+++ b/challenge-169/arne-sommer/perl/brilliant-numbers-perl
@@ -0,0 +1,53 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+use feature 'signatures';
+no warnings 'experimental::signatures';
+
+use Math::Prime::Util 'is_prime';
+
+my $count = shift(@ARGV) || 20;
+
+die "Please specify a positive integer" unless $count =~ /^[1-9]\d*$/;
+
+my @bn = ();
+
+my $candidate = 0;
+
+while (@bn != $count)
+{
+ $candidate++;
+
+ push(@bn, $candidate) if is_brilliant($candidate);
+}
+
+say join(", ", @bn);
+
+sub factors ($number)
+{
+ return (1) if $number == 1;
+ return ($number) if is_prime($number);
+
+ my @factors;
+
+ for my $candidate (grep { is_prime($_) } 2 .. $number / 2)
+ {
+ while ($number % $candidate == 0)
+ {
+ push(@factors, $candidate);
+ $number /= $candidate;
+ }
+ }
+
+ return @factors;
+}
+
+sub is_brilliant ($number)
+{
+ my @factors = factors($number);
+ return 0 unless @factors == 2;
+ return 0 unless length($factors[0]) == length($factors[1]);
+ return 1;
+}
diff --git a/challenge-169/arne-sommer/perl/ch-1.pl b/challenge-169/arne-sommer/perl/ch-1.pl
new file mode 100755
index 0000000000..5a6a78d790
--- /dev/null
+++ b/challenge-169/arne-sommer/perl/ch-1.pl
@@ -0,0 +1,53 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+use feature 'signatures';
+no warnings 'experimental::signatures';
+
+use Math::Prime::Util 'is_prime';
+
+my $count = shift(@ARGV) || 20;
+
+die "Please specify a positive integer" unless $count =~ /^[1-9]\d*$/;
+
+my @bn = ();
+
+my $candidate = 0;
+
+while (@bn != $count)
+{
+ $candidate++;
+
+ push(@bn, $candidate) if is_brilliant($candidate);
+}
+
+say join(", ", @bn);
+
+sub factors ($number)
+{
+ return (1) if $number == 1;
+ return ($number) if is_prime($number);
+
+ my @factors;
+
+ for my $candidate (grep { is_prime($_) } 2 .. $number / 2)
+ {
+ while ($number % $candidate == 0)
+ {
+ push(@factors, $candidate);
+ $number /= $candidate;
+ }
+ }
+
+ return @factors;
+}
+
+sub is_brilliant ($number)
+{
+ my @factors = factors($number);
+ return 0 unless @factors == 2;
+ return 0 unless length($factors[0]) == length($factors[1]);
+ return 1;
+}
diff --git a/challenge-169/arne-sommer/perl/ch-2.pl b/challenge-169/arne-sommer/perl/ch-2.pl
new file mode 100755
index 0000000000..1a4c199378
--- /dev/null
+++ b/challenge-169/arne-sommer/perl/ch-2.pl
@@ -0,0 +1,105 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+use feature 'signatures';
+no warnings 'experimental::signatures';
+
+use Math::Prime::Util 'is_prime';
+
+my $count = shift(@ARGV) || 20;
+
+die "Please specify a positive integer" unless $count =~ /^[1-9]\d*$/;
+
+my @achilles = ();
+
+my $candidate = 0;
+
+while (@achilles != $count)
+{
+ $candidate++;
+
+ push(@achilles, $candidate) if is_achilles($candidate);
+}
+
+say join(", ", @achilles);
+
+sub factors ($number)
+{
+ return (1) if $number == 1;
+ return ($number) if is_prime($number);
+
+ my @factors;
+
+ for my $candidate (grep { is_prime($_) } 2 .. $number / 2)
+ {
+ while ($number % $candidate == 0)
+ {
+ push(@factors, $candidate);
+ $number /= $candidate;
+ }
+ }
+
+ return @factors;
+}
+
+sub divisors ($number)
+{
+ my @divisors;
+
+ for my $candidate (2 .. $number/2)
+ {
+ push(@divisors, $candidate) if $number % $candidate == 0;
+ }
+
+ return @divisors;
+}
+
+sub is_powerful ($number)
+{
+ return 1 if $number == 1;
+
+ my @factors = factors($number);
+
+ my %values;
+
+ for my $val (@factors)
+ {
+ $values{$val}++;
+ }
+
+ for my $count (values %values)
+ {
+ return 0 if $count == 1;
+ }
+
+ return 1;
+}
+
+sub is_perfect ($number)
+{
+ return 1 if $number <= 1;
+
+ my @divisors = divisors($number);
+
+ return 0 unless @divisors;
+
+ for my $divisor (@divisors)
+ {
+ my $current = $divisor;
+
+ $current *= $divisor while $current < $number;
+
+ return 1 if $current == $number;
+ }
+
+ return 0;
+}
+
+sub is_achilles ($number)
+{
+ return 0 unless is_powerful($number);
+ return 0 if is_perfect($number);
+ return 1;
+}
diff --git a/challenge-169/arne-sommer/raku/achilles-numbers b/challenge-169/arne-sommer/raku/achilles-numbers
new file mode 100755
index 0000000000..75ce3d9c1a
--- /dev/null
+++ b/challenge-169/arne-sommer/raku/achilles-numbers
@@ -0,0 +1,92 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (Int :c(:$count) where $count > 0 = 20, :$powerful, :$perfect);
+
+my $bn;
+
+
+if ($powerful && ! $perfect)
+{
+ $bn := (1 .. Inf).grep( *.&is-powerful );
+}
+elsif ($perfect && !$powerful)
+{
+ $bn := (1 .. Inf).grep( *.&is-perfect );
+}
+else
+{
+ $bn := (1 .. Inf).grep( *.&is-achilles );
+}
+
+say $bn[^$count].join(", ");
+
+sub factors ($number is copy)
+{
+ return (1) if $number == 1;
+ return ($number) if $number.is-prime;
+
+ my @factors;
+
+ for (2 .. $number div 2).grep( *.is-prime) -> $candidate
+ {
+ while $number %% $candidate
+ {
+ @factors.push: $candidate;
+ $number /= $candidate;
+ }
+ }
+
+ return @factors;
+}
+
+sub divisors ($number,