blob: 9eed00f442b0eb6ad70a1072e90fb5047b7dba56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#! /usr/bin/env raku
subset Base of UInt where 1 < * <= 36;
unit sub MAIN (Base $base, :v(:$verbose));
my @digits = (( 0 .. 9, 'A' .. 'Z' ).flat)[0 .. $base -1];
for @digits.permutations.reverse -> @permutation
{
# last if @permutation[0] eq "0";
my $candidate = @permutation.join;
my $decimal = $candidate.parse-base($base);
my $sqrt = $decimal.sqrt;
say ": Checking $candidate (decimal: $decimal root: $sqrt)" if $verbose;
if $sqrt ~~ /^\d+$/
{
say $candidate;
last;
}
}
|