Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

Comment "Crunching" the numbers (Score 3, Informative) 239

If anyone else wants to "crunch" those numbers, here's some Perl:
use Date::Calc qw( Add_Delta_Days Day_of_Week );

my $MAX_YEAR=3000;
my @date = (1,1,1);

sub summer { $a = 0; foreach (@_) { $a += $_ } $a }

while( $date[0] < $MAX_YEAR ) {
@date = Add_Delta_Days( @date, 1 );
if( $date[2] == 13
&& Day_of_Week( @date ) == 5
&& summer( split '', sprintf( "%04d-%02d-%02d", @date ) ) == 13
) {
printf( "%04d-%02d-%02d\n", @date );
}
}
I get 2006-01-13 as the most recent occurrence.

Slashdot Top Deals

"Neighbors!! We got neighbors! We ain't supposed to have any neighbors, and I just had to shoot one." -- Post Bros. Comics

Working...