Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

egyptian_complete

Egyptian Fractions - Complete Search


Description

Generate all Egyptian fractions of length 2 and 3.

Usage

egyptian_complete(a, b, show = TRUE)

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.

Value

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

References

See Also

Examples

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.

numbers

Number-Theoretic Functions

v0.8-1
GPL (>= 3)
Authors
Hans Werner Borchers
Initial release
2021-04-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.