#!/usr/bin/perl use strict; use warnings; use feature qw/say/; while(my $n = shift @ARGV) { say grep { $n == $_ } map { $n += $_ } map { $n-- } map { ($n) x $_ } $n ;}