record perseq(pre, rep) procedure egypt_mantissa(n) local quotients, numer, quotient, seq, count quotients := table() seq := list(*n - 1, 0) # possible leading zeros numer := 1 || repl("0", *n) count := 1 while numer > 0 do { quotient := numer / n quotients[quotient] := count put(seq, quotient) numer �:= quotient * n numer *:= 10 count +:= 1 if count > 3 * n then return repeater(seq) } return perseq(seq, []) end