aboutsummaryrefslogtreecommitdiff
path: root/challenge-102/arne-sommer/raku/hash-counting-string
blob: ae353bd416b1483958fd33f90c39452cfcfe6e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env raku

unit sub MAIN (Int $N where $N > 0);

my $position = $N;
my $string   = "";

while ($position > 1)
{
  my $prefix = $position ~ '#';

  $string = $prefix ~ $string;
  $position -= $prefix.chars;
}

say $string.chars == $N
  ?? $string
  !! "#$string";