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.
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.
любое разложение суммы, сообщенной Б, на два слагаемых приводит к тому, что хотя бы одно из слагаемых содержит два множителя.
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:
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.
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.
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--)
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--)