Bash And A Tough Math Puzzle