Practicing math and logic with ruby