All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Fractional computation (Posted on 2006-11-21) Difficulty: 4 of 5
The following algorithm can be applied to a list of fractions and an integer input. You go down the list and multiply the input by the first fraction that will result in an integer. Taking this product as the new input, you repeat, using the same list of fractions. The algorithm ends when none of the fractions will result in an integer.

For example, if the list of fractions is {5/6, 5/2, 5/3}, then inputting an integer 2a * 3b will result in 5max(a,b). A more complicated example: inputting 2a * 3b into {7/11, 11/(3*7), 1/7, (5*7)/2, 3/5} will result in 3a (if a>0).

Find a list of fractions such that inputting an integer 2a * 3b will result in 5ab.

How about a list that, when the input is 2a * 3b, results in 5a^b (with b>0)?

See The Solution Submitted by Tristan    
Rating: 4.1818 (11 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Revised solution | Comment 6 of 7 |

This is a simple solution as well, but it uses 4 extra numbers and 6 steps. The idea is the same. Step D and E will turn each 2 into a 5 and 11 as long as there is still a 3. Once there are no 2s, step F will use up a 3 and activate steps A and B, which will turn each 11 back into a 2. Once there are no 11s, step C will activate, leading back to steps D and E, until each 3 is gone.

It's still not compact but it works and has only two complex fractions.

( (17*2)/(13*11), (13/17), (1/13), (5*7*11)/(2*3), (3/7), (13/3) ) 

(A)Convert 13 and 11 into 17 and 2

(B)Convert 17 into 13

(C)Convert 13 into nothing

(D)Convert 2 and 3 into 5, 7 and 11

(E) Convert 7 into 3,

(F) Convert 3 into 13


  Posted by Gamer on 2006-11-22 01:43:09
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information