#!/usr/bin/perl
use strict; # https://perlmonks.org/?node_id=11146507
use warnings;
for my $n ( 24, 25, 26 )
{
my $favorites = join '~~~', map "ab$_", 1 .. $n;
my $favnums = join '',
reverse map ',' . (split /\{3}/ )[2],
grep defined,
( split /~~~/, $favorites, 26 )[0 .. 24];
print "n = $n\n\n$favorites\n\n$favnums\n\n";
}
Outputs:
n = 24
ab1~~~ab2~~~ab3~~~ab4~~~ab5~~~ab6~
+~~ab7~~~ab8~~~ab9~~~ab10~~~ab11~~~ab
+12~~~ab13~~~ab14~~~ab15~~~ab16~~~ab1
+7~~~ab18~~~ab19~~~ab20~~~ab21~~~ab22~~~
+ab23~~~ab24
,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
n = 25
ab1~~~ab2~~~ab3~~~ab4~~~ab5~~~ab6~
+~~ab7~~~ab8~~~ab9~~~ab10~~~ab11~~~ab
+12~~~ab13~~~ab14~~~ab15~~~ab16~~~ab1
+7~~~ab18~~~ab19~~~ab20~~~ab21~~~ab22~~~
+ab23~~~ab24~~~ab25
,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
n = 26
ab1~~~ab2~~~ab3~~~ab4~~~ab5~~~ab6~
+~~ab7~~~ab8~~~ab9~~~ab10~~~ab11~~~ab
+12~~~ab13~~~ab14~~~ab15~~~ab16~~~ab1
+7~~~ab18~~~ab19~~~ab20~~~ab21~~~ab22~~~
+ab23~~~ab24~~~ab25~~~ab26
,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1
