egyptian_complete: Egyptian Fractions - Complete Search

View source: R/egyptian.R

egyptian_completeR Documentation

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

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

See Also

egyptian_methods

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 documentation built on Nov. 23, 2022, 9:06 a.m.