Write $solution as an Egyptian Fraction # Analyze the format
($formaterror,$doubleerror)=&analyze($submission);
if ($formaterror || $doubleerror) { return 'WRONG_FORMAT'; }
# It is an Egyptian Fraction, is the value correct?
if (&cas('maxima',$submission.'-('.$egyptian.')') eq '0') {
return 'EXACT_ANS';
}
return 'INCORRECT';if ((&analyze($submission))[0]) { return 'EXACT_ANS'; }
return 'INCORRECT';
Egyptian Fractions have a format of 1/number+1/number+..., for example 1/3+1/17+1/52.
if ((&analyze($submission))[1]) { return 'EXACT_ANS'; }
return 'INCORRECT';
Egyptian Fractions cannot have the same denominator more than once. For example, 1/3+1/17+1/4+1/17 is not an Egyptian Fraction, as it has 17 twice as denominator.