Solving a math problem with planner programming (buttondown.email)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 09 Jul 2024 15:56
https://programming.dev/post/16617523

The blog explains how to solve the following problem using Picat and planner programming, a form of logic programming:

Suppose that at the beginning there is a blank document, and a letter “a” is written in it. In the following steps, only the three functions of “select all”, “copy” and “paste” can be used.

Find the minimum number of steps to reach at least 100,000 a’s (each of the three operations of “select all”, “copy” and “paste” is counted as one step). If the target number is not specified, and I want to get the exact amount of "a"s, is there a general formula?

- Math Stack Exchange

#programming_languages

threaded - newest

cosmicbytes@programming.dev on 09 Jul 2024 22:10 collapse

What a great blog. Thanks!