use utf8;
use strict;
use warnings;
use feature 'say';
use List::Util 'uniq';

sub prime_factors {
    my ($n, $d, @factors) = (shift, 1);
    while ($n > 1 and $d++) {
        $n /= $d, push @factors, $d until $n % $d;
    }
    @factors
}

sub  {
    my @p = prime_factors(shift);
    @p == uniq(@p) ? 0 == @p%2 ? 1 : -1 : 0;
}

my @mebius;
push @mebius, ($_) for 1 .. (my $upto = 199);

say "Mbius sequence - First $upto terms:\n" .
    (' 'x4 . sprintf "@{['%4d' x $upto]}", @mebius) =~ s/((.){80})/$1\n/gr;