Learn R Programming

numbers (version 0.8-5)

egyptian_methods: Egyptian Fractions - Specialized Methods

Description

Generate Egyptian fractions with specialized methods.

Usage

egyptian_methods(a, b)

Value

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

Arguments

a, b

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

Details

For a rational number 0 < a/b < 1, generates Egyptian fractions that is finds integers x1, x2, ..., xk such that

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

using the following methods:

  • `greedy'

  • Fibonacci-Sylvester

  • Golomb (same as with Farey sequences)

  • continued fractions (not yet implemented)

References

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

See Also

egyptian_complete

Examples

Run this code
egyptian_methods(8, 11)
# 8/11 = 1/2 +  1/5 + 1/37 + 1/4070  (Fibonacci-Sylvester)
# 8/11 = 1/2 +  1/6 + 1/21 + 1/77    (Golomb-Farey)

# Other solutions
# 8/11 = 1/2 +  1/8 + 1/11 + 1/88
# 8/11 = 1/2 + 1/12 + 1/22 + 1/121

Run the code above in your browser using DataLab