Is there a more efficient algorithm for solving license plate math game?

  • Thread starter Thread starter uzi kiko
  • Start date Start date
  • Tags Tags
    Algorithm Force
Click For Summary

Discussion Overview

The discussion revolves around finding a more efficient algorithm for solving a mathematical game involving license plates, where participants aim to reach the number 120 using the digits from the plate and basic arithmetic operations. The scope includes algorithmic efficiency and programming considerations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes a family game that involves using digits from a license plate to reach the number 120 through arithmetic operations.
  • Another participant suggests that a brute force approach would involve checking 1024 combinations for 6 digits and 4 operators, but questions the need for a more efficient algorithm.
  • A different participant notes that allowing digits to be read as multiple digits increases the combinations to 3125, which is still manageable for brute force methods.
  • One participant expresses confusion regarding the rules of the game, specifically about the placement of brackets in the arithmetic expressions, which affects the outcome.
  • The original poster clarifies that the inquiry is primarily for educational purposes.

Areas of Agreement / Disagreement

Participants generally agree that a brute force algorithm is feasible for the problem at hand, but there is no consensus on whether a more efficient algorithm exists or what form it might take. The discussion remains unresolved regarding the specifics of the game rules and their implications for algorithm design.

Contextual Notes

There are limitations regarding the clarity of the game rules, particularly concerning the use of brackets in calculations, which could significantly affect the number of valid combinations and the approach to solving the problem.

uzi kiko
Messages
22
Reaction score
3
Hi
We have a family game when we are stuck in traffic similar to https://en.wikipedia.org/wiki/Countdown_(game_show)
(I know I am a nerd )

In the game we are looking at license plate of the car in front and trying to get 120 using the 4 arithmetic operators (+-*/) and the numbers in the license plate in the same order as they appear there.
For example:
If the license plate is 212614
2+1+2*6*1*4=120.

Obviously there is no solution for all the plates, but I would like to write a small program to find the solution (if exist) to check myself.

I can write a brute force algorithm that will go through all the options, but I wonder if there is a better algorithm.

Can you suggest a better solution?
 
Last edited by a moderator:
Technology news on Phys.org
I can't think of an algorithm off-hand other than trying all combinations which I think is 4^5 (1024) combinations for 6 digits/4 operators given that the digits are known.

Were you planning on doing this by PC or mobile?

Android has some apps like APDE (Android Processing Developers Environment) which could work well here. You'd be writing the app in Java on Android and running it on Android. For iOS there's Pythonista where you'd do the same but would be using Python. On the PC you could use the Processing IDe and write it in Java, Javascript or Python your choice.

There are other apps available but these are the ones I'm familiar with.
 
Better in what way? Faster?

For comparison, with 6 digits, 5 operator places and 4 operators, a simple brute force algorithm would have to check 1024 combinations which should be no problem on even very modest hardware. If you allow digits to be read as multiple digits you end up with 3125 combinations, still well within reach of brute force.
 
uzi kiko said:
I can write a brute force algorithm that will go through all the options, but I wonder if there is a better algorithm.

I'd be surprised if there were. I'm a bit confused about the rules though given your example:
2+1+2*6*1*4=120

2+1+2*6*1*4 is 51. However, (2+1+2)*6*1*4 = 120. So are you counting with any possible way of putting the brackets or do you mean something more specific (e.g., keeping a sort of running total)?
 
Thanks a lot for your answers.

The purpose of the question was mainly for my education...
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
3K
  • · Replies 39 ·
2
Replies
39
Views
4K
  • · Replies 10 ·
Replies
10
Views
5K
Replies
29
Views
5K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K