Conditions to check if AP can be formed using factor F
if ( ( ( S // i ) - D * i + D ) % 2 == 0 ) : NEW_LINE INDENT answer += 1 NEW_LINE DEDENT if ( ( D * i - ( S // i ) + D ) % 2 == 0 ) : NEW_LINE INDENT answer += 1 NEW_LINE DEDENT