blob: 37dd51a7a26dd82636234c57416cf7c76a50d399 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#! /usr/bin/env raku
unit sub MAIN (Int $N where $N > 0, :v(:$verbose));
my $seq := gather
{
my $current = 1;
take 1;
loop
{
my $new = "";
my $add = True;
for $current.comb.reverse -> $digit is copy
{
if $add
{
if $digit <= 2
{
$digit++;
$add = False;
}
else { $digit = 1; }
}
$new = $digit ~ $new;
}
$new = "1$new" if $add;
$current = $new;
take $current unless $current ~~ /11/;
}
}
say ": Sequence: ", $seq[^$N].join(', ') if $verbose;
say $seq[$N-1];
|