J. Insi

Ranch Hand

Posts: 90

posted 6 years ago

Hello guys...!

It's very funny because my little brother asked me this question;

What are the possibilities of a, b, and c ?

Could any body help me,

1st) What topic in math is this that I should look upon?

2nd) Step by step how to solve it (the way)...?

3rd)... your kindness....

Somebody outthere give me short explaination meanwhile, I need to erase my stupidity because of not aware of this calculation in my head. Anyway here is the words

But here, my concern is... why 2^9 could be

for that solving case?

It's very funny because my little brother asked me this question;

What are the possibilities of a, b, and c ?

Could any body help me,

1st) What topic in math is this that I should look upon?

2nd) Step by step how to solve it (the way)...?

3rd)... your kindness....

Somebody outthere give me short explaination meanwhile, I need to erase my stupidity because of not aware of this calculation in my head. Anyway here is the words

But here, my concern is... why 2^9 could be

**2^4 + 2^3 + 2^2**instead of**2^4 x 2^3 x 2^2**for that solving case?

Matthew Brown

Bartender

Posts: 4568

9

posted 6 years ago

I suspect the question is asking for (positive?) integer solutions. Which will at least give you a finite number of possibilites.

Bear Bibeault wrote:If it is really a math question and not a trick question, then there is not enough information to solve for a, b and c.

For three unknowns, you need three distinct equations to solve the problem.

I suspect the question is asking for (positive?) integer solutions. Which will at least give you a finite number of possibilites.

posted 6 years ago

Solving uniquely for three variables takes three linear equations, but abc = 1536 is not linear. I remember one branch of math where you could optimize one formula based on an insufficient number of linear equations. I believe it was called linear programing, though it had nothing to do with computers.

In any case, that's not what you're doing here. You're looking for a fast way to find the integer solution to these equations. Factoring 1536 into 3 * 2^9 is a good way to start because it gives you all the factors that will make up a, b, and c. It's a bit hard to explain if that doesn't click for you. 2^9 of course doesn't equal 2^4 + 2^3 + 2^2, but you will build up a, b, and c by multiplying one 3 with nine 2s. That gives you a quick way to limit your search for a solution.

When I just did it on paper, I started with a = 6 (3x2), and b = 16 (2x2x2x2), which left four of our nines 2s so c was forced to be 16. (I'm finding it difficult to explain what I mean by "left four of nine 2s". I think you'll either get it, or you won't.) Anyway, that meant the sum of a,b, and c was 38, almost right but not quite. So I thought to bring one of those 2s over to a, making it 12, and taking it away from b, making it 8. That kept c at 16. So, I got the answer in two guesses.

The technique of making a guess, and comparing its results to the true solution, and then adjusting, is called

In any case, that's not what you're doing here. You're looking for a fast way to find the integer solution to these equations. Factoring 1536 into 3 * 2^9 is a good way to start because it gives you all the factors that will make up a, b, and c. It's a bit hard to explain if that doesn't click for you. 2^9 of course doesn't equal 2^4 + 2^3 + 2^2, but you will build up a, b, and c by multiplying one 3 with nine 2s. That gives you a quick way to limit your search for a solution.

When I just did it on paper, I started with a = 6 (3x2), and b = 16 (2x2x2x2), which left four of our nines 2s so c was forced to be 16. (I'm finding it difficult to explain what I mean by "left four of nine 2s". I think you'll either get it, or you won't.) Anyway, that meant the sum of a,b, and c was 38, almost right but not quite. So I thought to bring one of those 2s over to a, making it 12, and taking it away from b, making it 8. That kept c at 16. So, I got the answer in two guesses.

The technique of making a guess, and comparing its results to the true solution, and then adjusting, is called

*regula falsi*. I don't know a name for the rest of what I did. Maybe we can call it JFM?
posted 6 years ago

Why is abc = 1536 non-linear? I assume it means a * b * c = 1536.

each variable is a first power, and the constant is 1 in each case...

A linear equation is an algebraic equation in which each term is either a constant or the product of a constant and (the first power of) a single variable.

each variable is a first power, and the constant is 1 in each case...

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Matthew Brown

Bartender

Posts: 4568

9

posted 6 years ago

Combinatorics? The brute force approach involves generating all possible combinations of three factors, and then checking the second condition.

Here's one pattern you could follow:

Of course, you can instantly rule out any combinations with 2^6 and above, or 3x2^4 and above, as they instantly exceed the target.

(All assuming we're talking positive integers, of course)

Here's one pattern you could follow:

Of course, you can instantly rule out any combinations with 2^6 and above, or 3x2^4 and above, as they instantly exceed the target.

(All assuming we're talking positive integers, of course)

Matthew Brown

Bartender

Posts: 4568

9

Mike Simmons

Ranch Hand

Posts: 3090

14

posted 6 years ago

duh...sorry.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Matthew Brown wrote:fred rosenberger wrote:Why is abc = 1536 non-linear? I assume it means a * b * c = 1536.

Because you're multiplying variables together. It doesn't satisfy the "single variable" part of that definition.

duh...sorry.

J. Insi

Ranch Hand

Posts: 90

Mike Simmons

Ranch Hand

Posts: 3090

14

posted 6 years ago

Not really. It's a program in the Haskell programming language. Personally I was learning about it as part of reading Seven Languages in Seven Weeks, which we had as a reading group at work. (By the way, if you do this: I recommend taking more than seven weeks. Maybe fourteen weeks. You can learn a lot if you work through all the problems, but it can take a lot of time.) I don't know if I will ever program in Haskell professionally, but it's a really good way to stretch your brain.

posted 6 years ago

Though Mathematical skills would help in programming, the above code is straightforward, taking the brute force approach. Further I also have been learning Haskell for one month and really love the language. Learning Haskell would definitely improve your programming skills and your way of thinking in programming.

- Marimuthu Madasamy

J. Insi

Ranch Hand

Posts: 90

posted 6 years ago

waw.... i've never involved in what that haskell thing....

great Mike, keep it up! is it difficult than our programming language or ....

Mike Simmons wrote:Not really. It's a program in the Haskell programming language. Personally I was learning about it as part of reading Seven Languages in Seven Weeks, which we had as a reading group at work. (By the way, if you do this: I recommend taking more than seven weeks. Maybe fourteen weeks. You can learn a lot if you work through all the problems, but it can take a lot of time.) I don't know if I will ever program in Haskell professionally, but it's a really good way to stretch your brain.

waw.... i've never involved in what that haskell thing....

great Mike, keep it up! is it difficult than our programming language or ....

It is sorta covered in the JavaRanch Style Guide. |