SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
ISayMoo
Topic Author
Posts: 1721
Joined: September 30th, 2015, 8:30 pm

Get 24 from 1, 3, 4 and 6

June 12th, 2019, 10:03 pm

Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers.
 
User avatar
katastrofa
Posts: 7660
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

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

June 15th, 2019, 12:26 pm

You'll need (), too...
 
User avatar
Collector
Posts: 4190
Joined: August 21st, 2001, 12:37 pm

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

June 15th, 2019, 1:39 pm

"Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers."

AI solutions allowed?: 
Screen Shot 2019-06-15 at 3.32.51 PM.png
 
User avatar
Alan
Posts: 9741
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

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

June 15th, 2019, 4:41 pm

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
 
User avatar
ISayMoo
Topic Author
Posts: 1721
Joined: September 30th, 2015, 8:30 pm

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

June 15th, 2019, 4:49 pm

And using standard arithmetics?
 
User avatar
Alan
Posts: 9741
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

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

June 15th, 2019, 4:56 pm

Can the numbers be used more than once? 
 
User avatar
Paul
Posts: 9112
Joined: July 20th, 2001, 3:28 pm

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

June 15th, 2019, 5:31 pm

"Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers."

AI solutions allowed?: 

Screen Shot 2019-06-15 at 3.32.51 PM.png
It does say “write.”
 
User avatar
katastrofa
Posts: 7660
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

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

June 15th, 2019, 7:52 pm

You need "(" and ")", too...
 
User avatar
ISayMoo
Topic Author
Posts: 1721
Joined: September 30th, 2015, 8:30 pm

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

June 15th, 2019, 7:53 pm

You'll need (), too...
Yes, sorry. 
 
User avatar
neauveq
Posts: 8
Joined: May 28th, 2018, 10:25 pm

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

June 15th, 2019, 10:37 pm

I couldn't figure it out, I am sure it involves some clever use of distributivity...

At first, I decided to factor 24 into prime factors 2*2*2*3 = a*a*a*b = (a^3)*b (note in this case (a^3)*b = 2*(a^2)*b = (a^2 + a^2)*b
Listing out the numbers we have:
1 = e (multiplicative identity)
3 = b
4 = 2*2 = a^2 (note in this case a^2 = 2*a = a + a)
6 = a*b
I tried various different combinations but with no avail.
None of this really proves or disproves anything but maybe a step in the right direction?
 
User avatar
katastrofa
Posts: 7660
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

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

June 15th, 2019, 11:18 pm

You need to use Deep Neural Networks.
 
User avatar
Alan
Posts: 9741
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

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

June 16th, 2019, 3:33 am

In Mathematica:

StringJoin[ToString[1*6/3], ToString[4]]

24
 
User avatar
Cuchulainn
Posts: 59024
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

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

June 16th, 2019, 11:50 am

In Mathematica:

StringJoin[ToString[1*6/3], ToString[4]]

24
I would have concerns about the run-time efficiency. Do the strings use hashing?
 
User avatar
Alan
Posts: 9741
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

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

June 16th, 2019, 11:21 pm

In Mathematica:

StringJoin[ToString[1*6/3], ToString[4]]

24
I would have concerns about the run-time efficiency. Do the strings use hashing?

answer = StringJoin[ToString[1*6/3], ToString[4]];
Hash[answer, "SHA256"]
87843000942654739416790862908851944946087349408853794374923081877917692795355
Hash["24", "SHA256"]
87843000942654739416790862908851944946087349408853794374923081877917692795355
Hash[answer, "SHA256"] == Hash["24", "SHA256"]
True
:D
 
User avatar
Cuchulainn
Posts: 59024
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

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

Today, 11:12 am

Write 24 using 1, 3, 4 and 6 and +, -, * or / operators. You have to use all 4 numbers.
What about a least-squares optimisation problem?
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On