Page 2 of 3

Re: Get 24 from 1, 3, 4 and 6

Posted: June 18th, 2019, 11:59 am
by katastrofa
How men invented useful problems.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 19th, 2019, 8:36 am
by Cuchulainn
Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers.
int main()
{
int a, b, c, d, answer;
a = 1;
b = 3;
c = 4;
d = 6;
answer = a/b + c*d;
printf("The answer is %d\n",answer);
}
// output: The answer is 24
a/b == 0 hmmm.. Implementation-dependent.

24 is a highly composite number, just like 5040. Coincidence?

Re: Get 24 from 1, 3, 4 and 6

Posted: June 20th, 2019, 11:05 pm
by neauveq
My guess is that such a solution is not possible if we are limited to +, -, /, * operations. I don't know enough Maths to prove or disprove this. As a newcomer to programming, I tried to have a crack at this in Python. I found 23, 23.(6), 24.(3), 25 but no 24.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 20th, 2019, 11:28 pm
by katastrofa
You need to use the mathematics of quantum neutrino fields!

Re: Get 24 from 1, 3, 4 and 6

Posted: June 20th, 2019, 11:42 pm
by neauveq
Hmm, what about the same problem but with numbers 8,6,7,5,3,0,9?



Re: Get 24 from 1, 3, 4 and 6

Posted: June 22nd, 2019, 2:56 pm
by Cuchulainn
Image

Re: Get 24 from 1, 3, 4 and 6

Posted: June 22nd, 2019, 3:09 pm
by katastrofa
All men. Wearing dresses, what?

Re: Get 24 from 1, 3, 4 and 6

Posted: June 22nd, 2019, 5:16 pm
by tagoma
Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers.
"or" in your post gets me somewhat confused. has one to use the 4 operators?

Re: Get 24 from 1, 3, 4 and 6

Posted: June 22nd, 2019, 10:38 pm
by ISayMoo
It's all right guys. It's OK not to know the answer.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 23rd, 2019, 6:06 am
by tagoma
It's all right guys. It's OK not to know the answer.
my answer would be 6/(1-(3/4)) that i got by brute force, but i’m not sure whether you require the all 4 arithmetics operators to be used (game statement is ambiguous for non English-native).
you introduce a game but seem reluctant to be more specific on rules. why?
btw what is the starting point to get to a result using an elegant mathematical reasoning?

Re: Get 24 from 1, 3, 4 and 6

Posted: June 23rd, 2019, 10:00 am
by ISayMoo
Your answer is accepted.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 23rd, 2019, 12:38 pm
by bearish
The closest I could get was (1+4+3*6)++

Re: Get 24 from 1, 3, 4 and 6

Posted: June 23rd, 2019, 1:43 pm
by katastrofa
I think (14-6)*3 is also an acceptable answer.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 23rd, 2019, 3:40 pm
by Cuchulainn
ISM is using you as guinea-pigs for a neurotic arithmetic experiment. It's like generating expressions.

Re: Get 24 from 1, 3, 4 and 6

Posted: June 30th, 2019, 1:22 pm
by katastrofa
Arithmetics is dangerous. Easy to sprain an ankle when doing all the jumps.