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.)
First question | Comment 1 of 7

The first list is ((13*2)/11, 11/(13*7), 1/13, (7*5)/2, 11/(7*3), 1/7)

The algorithm is

(A)Convert 11 into 13 and 2

(B)Convert 13 and 7 into 11

(C)Convert 13 into nothing 

(D)Convert 2 into 7 and 5

(E) Convert 7 and 3 into 11,

(F) Convert 7 into nothing

The idea is to first convert all 2 into an equal number of 7 and 5. Then, when you run out of 2, turn a 7 and 3 into an 11 so you can regenerate the 2, using the 7 which kept track of the number of 2. The process uses up a 3 and gives back an extra 13, which is removed once all the 7 are used up. Once all the 3 are used up, the algorithm ends after removing all 7.

EDIT: I messed up two of the fractions based on my algorithm, but it actually isn't right. I will post a tweak in another post.

Edited on November 22, 2006, 12:51 am
  Posted by Gamer on 2006-11-21 22:42:31

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 (11)
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