Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2009/12/21

The 12 Days: an analysis

Using this code:


#!/usr/bin/perl

use 5.010 ;
use strict ;
use warnings ;
use DateTime::TimeZone ;
use File::stat ;

my @count ;
my @days ;

$days[1] = 'Partridge in a Pear Tree' ;
$days[2] = 'Turtle Doves' ;
$days[3] = 'French Hens' ;
$days[4] = 'Calling Birds' ;
$days[5] = 'Golden Rings' ;
$days[6] = 'Geese A-laying' ;
$days[7] = 'Swans A-swimming' ;
$days[8] = 'Maids A-milking' ;
$days[9] = 'Ladies Dancing' ;
$days[10] = 'Lords A-leaping' ;
$days[11] = 'Pipers Piping' ;
$days[12] = 'Drummers Drumming' ;

for my $a ( 1 .. 12 ) {
for my $b ( 1 .. 12 ) {
next if $b > $a ;
$count[$b] ++ ;
}
}

for my $a ( 1 .. 12 ) {
say join ' ' , $count[$a] * $a , $days[$a] ;
}


I determined the precise number of each gift as presented in the song.


12 Partridge in a Pear Tree
22 Turtle Doves
30 French Hens
36 Calling Birds
40 Golden Rings
42 Geese A-laying
42 Swans A-swimming
40 Maids A-milking
36 Ladies Dancing
30 Lords A-leaping
22 Pipers Piping
12 Drummers Drumming

I suppose it preferable to have a smaller number of drummers than geese. Time to get into the geese and swan market, though.