#!/opt/perl-5.10.0/bin/perl use strict; use warnings; use feature ':5.10'; use Text::Table; for ( my $width = 15; $width == 15; ++$width ) { my $table = Text::Table->new; my $nth = 0; my $total = ( $width**2 - $width ) / 2; for my $III ( 1 .. $width ) { my @row = ('.') x $III; for my $JJJ ( $III + 1 .. $width ) { my $aha = $width + .5 - sqrt( 2 * ( $total - $nth ) ); my $row = int $aha; my $col = $row + 1 + int( ( $aha - $row ) * ( $width - $row ) ); push @row, "${row}x$col"; ++$nth; } $table->load( \@row ); } say "${width}x$width\n$table"; }