How to resolve the algorithm McNuggets problem step by step in the 11l programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm McNuggets problem step by step in the 11l programming language

Table of Contents

Problem Statement

Calculate (from 0 up to a limit of 100) the largest non-McNuggets number (a number n which cannot be expressed with 6x + 9y + 20z = n where x, y and z are natural numbers).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm McNuggets problem step by step in the 11l programming language

Source code in the 11l programming language

V nuggets = Set(0..100)
L(s, n, t) cart_product(0 .. 100 I/ 6,
                        0 .. 100 I/ 9,
                        0 .. 100 I/ 20)
   nuggets.discard(6*s + 9*n + 20*t)

print(max(nuggets))

  

You may also check:How to resolve the algorithm Here document step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Price fraction step by step in the BASIC programming language
You may also check:How to resolve the algorithm Walk a directory/Non-recursively step by step in the Pike programming language
You may also check:How to resolve the algorithm Pernicious numbers step by step in the J programming language
You may also check:How to resolve the algorithm Unicode variable names step by step in the ALGOL 68 programming language