[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 428

 
Mathemat:

What does phrase B mean? How does he know in advance that A will not guess the numbers when he gets the sum? This is a very succinct answer actually, it contains almost all the information about the numbers!


If the first pundit had been told the product of two prime numbers, he would have found the answer immediately.
 

This is obvious. The main thing is to decipher the second comment of the dialogue.

любое разложение суммы, сообщенной Б, на два слагаемых приводит к тому, что хотя бы одно из слагаемых содержит два множителя.

 
ValS:

Do you think anything will change?


Radically. Look.

Write out all possible combinations of pairs of numbers greater than one, the sum of
of which is less than a hundred (there are 2401 such pairs).

If you can think of two identical numbers, the number of pairs becomes much larger. Check:

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start(){
  int SchPar=0;
  for(int i=100;i>=2;i--){
    for(int ii=100;ii>=2;ii--){
      if(i+ii<100){
        SchPar++;
      }
    }
  }
  Alert("Общее число пар чисел, сумма которых менее 100 = ",SchPar);
  return(0);
}
//+------------------------------------------------------------------+

Now let's throw this script on the chart and what do we see? The number of pairs whose sum is less than a hundred = 4656.

 
ValS:

If the first pundit had been told the product of two prime numbers, he would have found the answer immediately.

Yes, but it's not certain that he would have been caught saying he found it so quickly.
 
What's a "gotcha"? It's probably best to assume they are telling the truth.
 
drknn:


Root. Look.

If you can think of two identical numbers, the number of pairs becomes much larger. Let's check:

Now let's throw this script to the chart and what do we see? The number of pairs whose sum is less than a hundred = 4656.


for(int ii=100;ii>=2;ii--) - this is not how it should be done here,

but like this.

for(int ii=i-1;ii>=2;ii--)

 
So you'd give yourself away. You'd give yourself away with a careless word.
 
ValS:


for(int ii=100;ii>=2;ii--) - not like this,

but like this

for(int ii=i-1;ii>=2;ii--)


No - this way we will never search the combination of two identical numbers, because the second number will always be 1 less.
 

We're going with what we've got.

And there is no need to duplicate pairs of numbers in a loop.

 

Then try it like this

for(int ii=i;ii>=2;ii--)