Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Symmetrical Date Golfby Anonymous Monk |
on Mar 01, 2002 at 00:44 UTC ( [id://148441]=note: print w/replies, xml ) | Need Help?? |
Ryan-
I got a chain letter two weeks back that claimed that 20:02 20/02 2002 was a miraculous phenomenon that has only happened once before and won't ever happen again... not sure whether they meant simply the date being a palindrome or, more likely, the fact that the date can be split by whitespace in 3 identical palindromes. Well, I didn't believe it, so i wrote this script: http://www.parseerror.com/perl/date_palindrome.pl http://www.parseerror.com/perl/date_palindrome.txt (in case your browser doesn't like .pl files) Which finds a total of 1164 palindromes between 1001-3003 AD. Of these, 4 turn out to be the "three identical palindromes"... 10:01 10/01 1001 11:11 11/11 1111 20:02 20/02 2002 21:12 21/12 2112 Anywho, all my results are included in the file and the source code is alot shorter and simpler than what you have, though it does take a while for the script to chug through all the dates from 1001-3003 AD. Hope someone finds this interesting... i figured i could do it with a one-liner, but was suprirsed to find out how complex this actual problem was. ryan aka pizza_milkshake
In Section
Meditations
|
|