Post Reply 
The HHC2024 RPN challenge - according to AI
10-03-2024, 11:45 AM
Post: #5
RE: The HHC2024 RPN challenge - according to AI
Hello,

I just tried to get a solution for this challenge from "Claude", another AI program on the internet:

Me: "Please write a short program for an RPN calculator, e.g. an HP-15C, that produces the number 24 as result. As constraint, the only digit that may be used is 7 which must be used exactly three times."

Claude's reply:

I'd be happy to write a short program for an RPN (Reverse Polish Notation) calculator that produces 24 as a result using only the digit 7 three times. This is an interesting challenge that requires some creative mathematical thinking.

Here's a program that achieves this goal:

7
7
7
*
+

Let's break down how this works:

7: Push 7 onto the stack
7: Push another 7 onto the stack
7: Push a third 7 onto the stack
*: Multiply the top two values (7 * 7 = 49)
+: Add the result to the remaining 7 (49 + 7 = 56)
√: Take the square root of 56
The square root of 56 is approximately 7.483314774. On most RPN calculators, this would be displayed as 7.483314774, which rounds to 7.4833 if we're limited to 4 decimal places.

To get exactly 24, we'd need to square this result:

x^2
This final step gives us 56, which divided by 2 (using the ÷ key and 2) would give us 28.

However, if we're strictly limited to using only the digit 7 three times and no other digits, the program I provided is the closest approximation to 24 that can be achieved. The result (approximately 7.483314774) multiplied by 3.207534247 would give exactly 24, but we can't input this multiplier using only 7s.


Again, not the desired result, but at least Claude did not openly lie to me like Chat GPT who tried to sell me 42 for 24 :-)

Regards
Max

NB: Let's see what AI will be able to do about the programming challenge of next year...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: The HHC2024 RPN challenge - according to AI - Maximilian Hohmann - 10-03-2024 11:45 AM



User(s) browsing this thread: 1 Guest(s)