Skip to main content
fix header
Source Link
Denis Ibaev
  • 1.2k
  • 7
  • 8

Perl 5, 53 + 2 (-p flag) = 55 bytes

Perl 5, 53 + 2 (-p flag) = 55 bytes

$_="@{[map{$_,$n/$_.$/}grep!($n%$_),2..sqrt($n=$_)]}"

Ungolfed:

while (defined $_ = <>) {
    $n = $_;
    $_ = qq(@{[
        map{ ($_, ($n / $_) . "\n") } grep { !($n % $_) } (2 .. sqrt($n))
    ]});
    print($_);
}

Try it online.

Perl 5, 53 + 2 (-p flag) = 55 bytes

$_="@{[map{$_,$n/$_.$/}grep!($n%$_),2..sqrt($n=$_)]}"

Ungolfed:

while (defined $_ = <>) {
    $n = $_;
    $_ = qq(@{[
        map{ ($_, ($n / $_) . "\n") } grep { !($n % $_) } (2 .. sqrt($n))
    ]});
    print($_);
}

Try it online.

Perl 5, 53 + 2 (-p flag) = 55 bytes

$_="@{[map{$_,$n/$_.$/}grep!($n%$_),2..sqrt($n=$_)]}"

Ungolfed:

while (defined $_ = <>) {
    $n = $_;
    $_ = qq(@{[
        map{ ($_, ($n / $_) . "\n") } grep { !($n % $_) } (2 .. sqrt($n))
    ]});
    print($_);
}

Try it online.

Source Link
Denis Ibaev
  • 1.2k
  • 7
  • 8

Perl 5, 53 + 2 (-p flag) = 55 bytes

$_="@{[map{$_,$n/$_.$/}grep!($n%$_),2..sqrt($n=$_)]}"

Ungolfed:

while (defined $_ = <>) {
    $n = $_;
    $_ = qq(@{[
        map{ ($_, ($n / $_) . "\n") } grep { !($n % $_) } (2 .. sqrt($n))
    ]});
    print($_);
}

Try it online.