10/02/22 Computing Challenge

As this post was published on the 7th of February 2022 (07/02/22), we would like to use a Python algorithm to solve the following arithmetic puzzle:

10-02-22-arithmetic-puzzleLet’s consider a string consisting of 10 characters “2”: string = “2222222222”

This computing challenge consists of writing an algorithm to work out the largest number we can create by inserting 2 multiplication operators (*) anywhere within this string.

For instance:

  • 2 * 2 * 22222222 = 88,888,888
  • 2 * 22 * 2222222 = 97,777,768
  • 2222 * 2222 * 22 = 108,620,248
  • 222 * 222 * 2222 = 109,509,048
  • etc.

10th February 2022

Python Code

You can use the trinket below to write and test your algorithm… We have started the code for you to test all possible positions of the first multiplication operator. Your task is to complete this code to:

  1. Add a second multiplication sign and test every possible position for this second sign,
  2. Calculate the result of each expression and output the largest value reached.


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 8

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!