Created
December 18, 2012 20:58
-
-
Save zxjinn/4331917 to your computer and use it in GitHub Desktop.
quick and dirty way to brute force palindromes in the gregorian calendar using the format MM/DD/YYYY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# quick and dirty way to brute force palindromes in the gregorian calendar | |
# using the format MM/DD/YYYY | |
MAX=5000000000000 | |
i=0 | |
while [ $i -ne $MAX ] | |
do | |
i=$[$i+1] | |
MONTHZ=$(date +%m --date "-${i} days") | |
DAYZ=$(date +%d --date "-${i} days") | |
YEARZ=$(date +%Y --date "-${i} days") | |
FIRSTZ=$(echo ${MONTHZ}${DAYZ}|rev) | |
LASTZ=$YEARZ | |
if [ $FIRSTZ -eq $LASTZ ]; then | |
echo $(date +%m"/"%d"/"%Y --date "-${i} days") | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment