Learn R Programming

numbers (version 0.3-1)

egyptian_complete: Egyptian Fractions - Complete Search

Description

Generate all Egyptian fractions of length 2 and 3.

Usage

egyptian_complete(a, b)

Arguments

a, b
integers, a != 1, a < b and a, b relatively prime.

Value

  • No return value, all solutions found will be printed to the console.

Details

For a rational number 0 < a/b < 1, generates all Egyptian fractions of length 2 and three, that is finds integers x1, x2, x3 such that

a/b = 1/x1 + 1/x2 a/b = 1/x1 + 1/x2 + 1/x3.

References

http://www.ics.uci.edu/~eppstein/numth/egypt/

See Also

egyptian_methods

Examples

Run this code
egyptian_complete(6, 7)         # 1/2 + 1/3 + 1/42
egyptian_complete(8, 11)        # no solution found

# TODO
# 2/9 = 1/9 + 1/10 + 1/90          is not recognized
# 13/30 = 1/3 + 1/(3*4) + 1/(3*5)  -"-

Run the code above in your browser using DataLab