Greedy algorithm for Egyptian fractions: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 58: | Line 58: | ||
{{out}} |
{{out}} |
||
⚫ | |||
<pre>(egyption-fractions 43 48) |
<pre>(egyption-fractions 43 48) |
||
(egyption-fractions 5 121) |
(egyption-fractions 5 121) |
||
(egyption-fractions 2014 59) |
(egyption-fractions 2014 59) |
||
(egyption-fractions 8 97) |
(egyption-fractions 8 97)</pre> |
||
</pre> |
|||
⚫ | |||
<pre>(1/2 1/3 1/16) |
<pre>(1/2 1/3 1/16) |
||
(1/25 1/757 1/763309 1/873960180913 1/1527612795642093418846225) |
(1/25 1/757 1/763309 1/873960180913 1/1527612795642093418846225) |
||
Line 71: | Line 70: | ||
1/18943537893793408504192074528154430149 |
1/18943537893793408504192074528154430149 |
||
1/538286441900380211365817285104907086347439746130226973253778132494225813153 |
1/538286441900380211365817285104907086347439746130226973253778132494225813153 |
||
1/579504587067542801713103191859918608251030291952195423583529357653899418686342360361798689053273749372615043661810228371898539583862011424993909789665) |
1/579504587067542801713103191859918608251030291952195423583529357653899418686342360361798689053273749372615043661810228371898539583862011424993909789665)</pre> |
||
</pre> |
|||
Other tests: |
Other tests: |
||
<pre>(test 999 #'length) |
<pre>(test 999 #'length) |
||
(test 999 (lambda (xs) (loop for x in xs maximizing (denominator x)))) |
(test 999 (lambda (xs) (loop for x in xs maximizing (denominator x))))</pre> |
||
</pre> |
|||
<pre>(493/457 . 13) |
<pre>(493/457 . 13) |