Solution to various math & programming questions using ruby