Topcoder SRM 643 Div1 250

Tags: Math, Prime.