Learn R Programming

numbers (version 0.8-5)

egyptian_complete: Egyptian Fractions - Complete Search

Description

Generate all Egyptian fractions of length 2 and 3.

Usage

egyptian_complete(a, b, show = TRUE)

Value

All solutions found will be printed to the console if show=TRUE; returns invisibly the number of solutions found.

Arguments

a, b

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

show

logical; shall solutions found be printed?

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

https://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 with 2 or 3 fractions

# TODO
# 2/9 = 1/9 + 1/10 + 1/90       # is not recognized, as similar cases,
                                # because 1/n is not considered in m/n.

Run the code above in your browser using DataLab