473,411 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Guess the faulty machine

ashitpro
542 Expert 512MB
There are 7 machines, each of them produces the coin of weight 2 grams.
Someday somehow one machine gets faulty and started producing coin of weight 1 gram. All coins looks similar in dimensions.
You can take any number of coins from any machine.
Condition is that, whatever coins taken from 7 machines would be weighted only once.
Can somebody find the faulty machine.
Sep 26 '07 #1
5 1283
Nepomuk
3,112 Expert 2GB
There are 7 machines, each of them produces the coin of weight 2 grams.
Someday somehow one machine gets faulty and started producing coin of weight 1 gram. All coins looks similar in dimensions.
You can take any number of coins from any machine.
Condition is that, whatever coins taken from 7 machines would be weighted only once.
Can somebody find the faulty machine.
Let's say, the machines are called m0 - m6. Take 2^0 = 1 coin from m0, 2^1 = 2 coins from m1 and so on. So if all machines work correctly, you should have 1*2 + 2*2 + 4*2 + 8*2 + 16*2 + 32*2 + 64*2 = 127*2 = 254 grams.

Say, m3 is faulty. Then you'll have 1*2 + 2*2 + 4*2 + 8*1 + 16*2 + 32*2 + 64*2 = 127*2 - 8 = 246 grams. So basically, you take those coins, weigh them and the difference between the weight and 254 grams gives you the faulty machine (2^X difference -> mX is faulty).

Where's the next question? ^^

Greetings,
Nepomuk
Sep 26 '07 #2
sitko
140 100+
Wouldn't it make more sense, to make each subgrouping get bigger by a factor of 10, instead of a factor of 2?

Then you'd get a lot more coins that you could spend after the problem is solved.

:)
Oct 3 '07 #3
Banfa
9,065 Expert Mod 8TB
Wouldn't it make more sense to use an arithmetic progression rather than a geometric one.

That is rather than 2^0, 2^1, 2^2, 2^2 ... take 1, 2, 3, 4, 5, 6, 7, then the number of grams you are short is the machine number + 1.
Oct 3 '07 #4
sitko
140 100+
Wouldn't it make more sense to use an arithmetic progression rather than a geometric one.

That is rather than 2^0, 2^1, 2^2, 2^2 ... take 1, 2, 3, 4, 5, 6, 7, then the number of grams you are short is the machine number + 1.
No, I know that wouldn't work. It would be more confusing to figure out specifically which subgroup of coins was the culprit.

as if 6 was the bad one, it would weigh the same as a good 3, ...maybe it would work...I'll let smarter people chime in...

:)
Oct 3 '07 #5
jkmyoung
2,057 Expert 2GB
Banfa's correct. Using powers of 2 just complicates things.

I think the assumption missed is that all the coins you get from the 7 machines are weighed altogether.
Oct 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: EAS | last post by:
Hey, I'm new to python (and programming in general) so I'll prolly be around here a lot... Anyways, I've found out how to make a "guess my number game" where the player guesses a number between...
9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
7
by: Anjali M | last post by:
#include<stdio.h> int main() { int a = 10; switch(a) { case '1': printf("ONE\n"); break; case '2':
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
3
by: Neil Cerutti | last post by:
How do I cope with faulty encoding settings? I'm writing an application that needs all internal character data to be stored in iso-8859-1. It also must allow input and output using stdin and...
16
by: shana07 | last post by:
What's that mean by faulty program in java? I am told that it is any wrong in calculation for numerical program. Really appreciate if someone could give examples here to clarify about this topic. ...
166
by: Nimmi Srivastav | last post by:
Apologies if my cross posting has offended anyone.... For a pure hobbyist C/C++ programmer, who wants to develop applications to run on Windows, what would be a better choice to install: Visual...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.