• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Math: abc = 1536 and...

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 2^4 + 2^3 + 2^2 instead of 2^4 x 2^3 x 2^2
for that solving case?
 
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 3034
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 regula falsi. I don't know a name for the rest of what I did. Maybe we can call it JFM?
 
lowercase baba
Posts: 12751
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is abc = 1536 non-linear? I assume it means a * b * c = 1536.

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...
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
security forum advocate
Posts: 216
1
Android Flex Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Factorize and permutate...
 
Ranch Hand
Posts: 72
Scala Monad Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taking the brute force approach and to have some fun with Haskell:



which returned [(8,12,16),(8,16,12),(12,16,8)]
 
Ranch Foreman
Posts: 3268
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very nice.

If we allow negative numbers (and why not?), there's another set of solutions: (-8,-4,48) and its permutations.
 
fred rosenberger
lowercase baba
Posts: 12751
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Marimuthu Madasamy wrote:Taking the brute force approach and to have some fun with Haskell:



which returned [(8,12,16),(8,16,12),(12,16,8)]



waaah, I never calculate in this manner.... guys, are you all taking math class right now?
 
Mike Simmons
Ranch Foreman
Posts: 3268
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Scala Monad Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ....
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!