P893
projecteuler.net

Matchsticks

ℹ️Published on Sunday, 2nd June 2024, 11:00 am; Solved by 609;
Difficulty rating: 15%

Define $M(n)$ to be the minimum number of matchsticks needed to represent the number $n$.

A number can be represented in digit form or as an expression involving addition and/or multiplication. Also order of operations must be followed, that is multiplication binding tighter than addition. Any other symbols or operations, such as brackets, subtraction, division or exponentiation, are not allowed.

The valid digits and symbols are shown below:

0893_DigitDiagram.jpg

For example, $28$ needs $12$ matchsticks to represent it in digit form but representing it as $4\times 7$ would only need $9$ matchsticks and as there is no way using fewer matchsticks $M(28) = 9$.

Define $\displaystyle T(N) = \sum_{n=1}^N M(n)$. You are given $T(100) = 916$.

Find $T(10^6)$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.