"Source: Text/Aggregates/Seq.text";
"Line: 1172";
"Date: Thu Sep 25 14:47:47 2025";
"Main: Fri Sep 26 14:29:19 2025";
// original file: Text/Aggregates/Seq.text, line: 1172
// Example: H11E4 ()
print "Example: H11E4";
ei := GetEchoInput();
SetEchoInput(true);
egyptian := function(r)
      n := Numerator(r);
      d := Denominator(r);
      s := [d : i in [1..n]];
      t := { d};
      i := 2;
      while i le #s do
             c := s[i];
             if c in t then
                    Remove(~s, i);
                    s cat:= [c+1, c*(c+1)];
             else
                    t join:= { c};
                    i := i+1;
             end if;
      end while;
      return s;
end function;
e := egyptian(11/13);
// Check the result!
&+[1/d : d in e];
#e;
#IntegerToString(Maximum(e));
SetEchoInput(ei);
