Finding lowest number to multiply a fraction and get a whole I am trying to find the multiplier for a fraction that will let me get a whole number. So trying to solve c=a xx b Where a is a number like 1.6 or 0.7 or 5.24 Where b is the lowest number that a can be multiplied by to make c a whole number. The use case is in a game I am programming the currency is only in whole numbers of a single denomination (single gold coins) if the player wants to sell a quantity of items that are worth a fractional value like 1.6, how many must they sell so they can receive a whole number without throwing out the fractions.

Leia Hood 2022-08-15 Answered
Finding lowest number to multiply a fraction and get a whole
I am trying to find the multiplier for a fraction that will let me get a whole number.
So trying to solve c = a × b
Where a is a number like 1.6 or 0.7 or 5.24
Where b is the lowest number that a can be multiplied by to make c a whole number.
The use case is in a game I am programming the currency is only in whole numbers of a single denomination (single gold coins) if the player wants to sell a quantity of items that are worth a fractional value like 1.6, how many must they sell so they can receive a whole number without throwing out the fractions.
You can still ask an expert for help

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

Solve your problem for the price of one coffee

  • Available 24/7
  • Math expert for every subject
  • Pay only if we can solve it
Ask Question

Answers (2)

Brooks Hogan
Answered 2022-08-16 Author has 18 answers
Multiply a = 8 5 by b = 5 to get
c = 8 5 5 = 8
When a rational number is expressed as a fraction n d that is fully reduced meaning gcd ( n , d ) = 1, with (n, numerator; d, denominator, each an integer,) then we have
a = n d  so we put  b = d ,
and so
c = n d d = n
That is, any rational number expressed as a fully reduced fraction where the numerator and denominator are co-prime, then the lowest integer value for b is given by b d, where d is the denominator of the fully reduced fraction = a
Not exactly what you’re looking for?
Ask My Question
Mark Elliott
Answered 2022-08-17 Author has 6 answers
I'd suggest this algorithm: multiply by 10 repeatedly until you have an integer. You can now write your decimal as a fraction: k 10 n . Then, use any factorization algorithm to find the greatest common divisor of k and 10 n , and divide both the numerator and denominator by that. This puts the fraction in lowest terms, and now the denominator is the number you wanted.
For the record: This is a horribly inefficient algorithm. If you need it to be fast (for example, if you're trying to do billions of these calculations) you'll want to do something else. But it'll work if you're only trying to do it a hundred times a second, or something like that.
Not exactly what you’re looking for?
Ask My Question

Expert Community at Your Service

  • Live experts 24/7
  • Questions are typically answered in as fast as 30 minutes
  • Personalized clear answers
Learn more

You might be interested in

asked 2022-02-07
Find the quotient: 5÷15?
asked 2022-07-07
How to find the value of a and b from this limit problem with or without L'Hopital's formula?
Consider the limit:
lim x 4 x 2 + a x + b x 4 = 14
Question: How can I find the values of a and b?
Attempt:
My first thought is, we need to use L'Hopital's rule to make sure that the denominator isn't zero:
Applying L'Hopital's rule, and we get:
lim x 4 2 x + a 1 = 14
Then, we can substitute the limit of x to the equation such that:
2 ( 4 ) + a = 8 + a = 14
and we get that the value of a is 6.
But, how can I find the value of b? It seems that after applying the L'Hopital's formula the value of b disappears.
Also, is there a way to solve this problem without L'Hopital's rule?
Thanks
asked 2021-11-16
Use the distributive property to write each expression without parentheses. Then simplify the result.
5(x+4m+2)
asked 2022-06-20
Simplifying nested/complex fractions with variables
I have the equation
x = y + y y 70 + y 90
and I need to solve for x. My calculator has already shown me that it's not necessary to know y to solve this equation, but I can't seem to figure it out. This is how I try to solve it:
x = y + y y 70 + y 90 = 2 y ( 70 y + 90 y ) = 2 y ( 90 + 70 y ) = 2 y 160 y = 320 y y = 320
But according to my calculator, this is not correct. The answer should be 78.75, but I don't know why. Any help would be much appreciated.
asked 2022-04-10
Comparison of two values
I have to figure out the relation between the quantity ( 0.9 / 1.1 ) 2 + ( 1.1 / 0.9 ) 2 and 2. How can i do this without explicitly calculating the first value, by using some laws of exponents?
asked 2022-07-07
Find x 2 y 2 + y 2 x 2
If x y + y x = 3
asked 2022-04-03
Evaluate the expression
121210+50+222220+50++80280280+50
What should I do after that ?
n2n210n+50
I'm not seeing anything to find some way to cancel out the terms or something like that !