{
  "index": "1979-A-1",
  "type": "ALG",
  "tag": [
    "ALG",
    "NT"
  ],
  "difficulty": "",
  "question": "Problem A-1\nFind positive integers \\( n \\) and \\( a_{1}, a_{2}, \\ldots, a_{n} \\) such that\n\\[\na_{1}+a_{2}+\\cdots+a_{n}=1979\n\\]\nand the product \\( a_{1} a_{2} \\cdots a_{n} \\) is as large as possible.",
  "solution": "A-1.\nWe see that \\( n=660 \\) and that all but one of the \\( a_{i} \\) equal 3 and the exceptional \\( a_{i} \\) is a 2 as follows. No \\( a_{i} \\) can be greater than 4 since one could increase the product by replacing 5 by \\( 2 \\cdot 3,6 \\) by \\( 3 \\cdot 3 \\), 7 by \\( 3 \\cdot 4 \\), etc. There cannot be both a 2 and a 4 or three 2 's among the \\( a_{i} \\) since \\( 2 \\cdot 4<3 \\cdot 3 \\) and \\( 2 \\cdot 2 \\cdot 2<3 \\cdot 3 \\). Also, there cannot be two 4's since \\( 4 \\cdot 4<2 \\cdot 3 \\cdot 3 \\). Clearly, no \\( a_{i} \\) is a 1 . Hence the \\( a_{i} \\) are 3's except possibly for a 4 or for a 2 or for two 2 's. Since \\( 1979=3 \\cdot 659+2 \\), the only exception is a 2 and \\( n=660 \\).",
  "vars": [
    "n",
    "a_1",
    "a_2",
    "a_n",
    "a_i"
  ],
  "params": [],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "n": "numterms",
        "a_1": "firstterm",
        "a_2": "secondterm",
        "a_n": "lastterm",
        "a_i": "ithterm"
      },
      "question": "Problem A-1\nFind positive integers \\( numterms \\) and \\( firstterm, secondterm, \\ldots, lastterm \\) such that\n\\[\nfirstterm+secondterm+\\cdots+lastterm=1979\n\\]\nand the product \\( firstterm\\, secondterm \\cdots lastterm \\) is as large as possible.",
      "solution": "A-1.\nWe see that \\( numterms=660 \\) and that all but one of the \\( ithterm \\) equal 3 and the exceptional \\( ithterm \\) is a 2 as follows. No \\( ithterm \\) can be greater than 4 since one could increase the product by replacing 5 by \\( 2 \\cdot 3,6 \\) by \\( 3 \\cdot 3 \\), 7 by \\( 3 \\cdot 4 \\), etc. There cannot be both a 2 and a 4 or three 2 's among the \\( ithterm \\) since \\( 2 \\cdot 4<3 \\cdot 3 \\) and \\( 2 \\cdot 2 \\cdot 2<3 \\cdot 3 \\). Also, there cannot be two 4's since \\( 4 \\cdot 4<2 \\cdot 3 \\cdot 3 \\). Clearly, no \\( ithterm \\) is a 1. Hence the \\( ithterm \\) are 3's except possibly for a 4 or for a 2 or for two 2 's. Since \\( 1979=3 \\cdot 659+2 \\), the only exception is a 2 and \\( numterms=660 \\)."
    },
    "descriptive_long_confusing": {
      "map": {
        "n": "lighthouse",
        "a_1": "pineapple",
        "a_2": "chocolate",
        "a_n": "wafflecone",
        "a_i": "buttercup"
      },
      "question": "Problem A-1\nFind positive integers \\( lighthouse \\) and \\( pineapple, chocolate, \\ldots, wafflecone \\) such that\n\\[\npineapple+chocolate+\\cdots+wafflecone=1979\n\\]\nand the product \\( pineapple\\, chocolate \\cdots wafflecone \\) is as large as possible.",
      "solution": "A-1.\nWe see that \\( lighthouse=660 \\) and that all but one of the \\( buttercup \\) equal 3 and the exceptional \\( buttercup \\) is a 2 as follows. No \\( buttercup \\) can be greater than 4 since one could increase the product by replacing 5 by \\( 2 \\cdot 3,6 \\) by \\( 3 \\cdot 3 \\), 7 by \\( 3 \\cdot 4 \\), etc. There cannot be both a 2 and a 4 or three 2 's among the \\( buttercup \\) since \\( 2 \\cdot 4<3 \\cdot 3 \\) and \\( 2 \\cdot 2 \\cdot 2<3 \\cdot 3 \\). Also, there cannot be two 4's since \\( 4 \\cdot 4<2 \\cdot 3 \\cdot 3 \\). Clearly, no \\( buttercup \\) is a 1 . Hence the \\( buttercup \\) are 3's except possibly for a 4 or for a 2 or for two 2 's. Since \\( 1979=3 \\cdot 659+2 \\), the only exception is a 2 and \\( lighthouse=660 \\)."
    },
    "descriptive_long_misleading": {
      "map": {
        "n": "endlessnum",
        "a_1": "lastentry",
        "a_2": "finalpiece",
        "a_n": "firstpiece",
        "a_i": "constantpart"
      },
      "question": "Problem A-1\nFind positive integers \\( endlessnum \\) and \\( lastentry, finalpiece, \\ldots, firstpiece \\) such that\n\\[\nlastentry+finalpiece+\\cdots+firstpiece=1979\n\\]\nand the product \\( lastentry finalpiece \\cdots firstpiece \\) is as large as possible.",
      "solution": "A-1.\nWe see that \\( endlessnum=660 \\) and that all but one of the \\( constantpart \\) equal 3 and the exceptional \\( constantpart \\) is a 2 as follows. No \\( constantpart \\) can be greater than 4 since one could increase the product by replacing 5 by \\( 2 \\cdot 3,6 \\) by \\( 3 \\cdot 3 \\), 7 by \\( 3 \\cdot 4 \\), etc. There cannot be both a 2 and a 4 or three 2 's among the \\( constantpart \\) since \\( 2 \\cdot 4<3 \\cdot 3 \\) and \\( 2 \\cdot 2 \\cdot 2<3 \\cdot 3 \\). Also, there cannot be two 4's since \\( 4 \\cdot 4<2 \\cdot 3 \\cdot 3 \\). Clearly, no \\( constantpart \\) is a 1. Hence the \\( constantpart \\) are 3's except possibly for a 4 or for a 2 or for two 2 's. Since \\( 1979=3 \\cdot 659+2 \\), the only exception is a 2 and \\( endlessnum=660 \\)."
    },
    "garbled_string": {
      "map": {
        "n": "xkqpenryl",
        "a_1": "zvjdsoqta",
        "a_2": "lfrwepizh",
        "a_n": "qmrakxehu",
        "a_i": "btsaujcym"
      },
      "question": "Problem A-1\nFind positive integers \\( xkqpenryl \\) and \\( zvjdsoqta, lfrwepizh, \\ldots, qmrakxehu \\) such that\n\\[\nzvjdsoqta+lfrwepizh+\\cdots+qmrakxehu=1979\n\\]\nand the product \\( zvjdsoqta\\, lfrwepizh \\cdots qmrakxehu \\) is as large as possible.",
      "solution": "A-1.\nWe see that \\( xkqpenryl=660 \\) and that all but one of the \\( btsaujcym \\) equal 3 and the exceptional \\( btsaujcym \\) is a 2 as follows. No \\( btsaujcym \\) can be greater than 4 since one could increase the product by replacing 5 by \\( 2 \\cdot 3,6 \\) by \\( 3 \\cdot 3 \\), 7 by \\( 3 \\cdot 4 \\), etc. There cannot be both a 2 and a 4 or three 2 's among the \\( btsaujcym \\) since \\( 2 \\cdot 4<3 \\cdot 3 \\) and \\( 2 \\cdot 2 \\cdot 2<3 \\cdot 3 \\). Also, there cannot be two 4's since \\( 4 \\cdot 4<2 \\cdot 3 \\cdot 3 \\). Clearly, no \\( btsaujcym \\) is a 1 . Hence the \\( btsaujcym \\) are 3's except possibly for a 4 or for a 2 or for two 2 's. Since \\( 1979=3 \\cdot 659+2 \\), the only exception is a 2 and \\( xkqpenryl=660 \\)."
    },
    "kernel_variant": {
      "question": "Problem.\nFind all positive integers n together with multisets of positive integers {a₁, a₂, … , aₙ} such that\n  a₁ + a₂ + ⋯ + aₙ = 2002\nand for which the product a₁a₂⋯aₙ is as large as possible.  State all multisets that attain this maximum and the corresponding value(s) of n.",
      "solution": "Solution.\nLet P = a₁a₂⋯aₙ.  We progressively restrict the possible summands that can occur in a decomposition with maximal product.\n\n1.  No summand exceeds 4.\n    For every integer k ≥ 5 we have\n  k < 3 · (k − 3).\n    Thus replacing any summand k ≥ 5 by the two summands 3 and k − 3 keeps the total sum the same and strictly increases the product.  Repeating this operation removes all summands ≥ 5 without decreasing P.  Therefore each aᵢ ∈ {2, 3, 4}.\n\n2.  Additional restrictions among 2, 3 and 4.\n    a) 1 never occurs: deleting a 1 and adding 1 to some other summand leaves the sum unchanged while multiplying the product by that other summand (>1).\n    b) Two 4’s cannot occur because 4·4 = 16 < 2·3·3 = 18, and 4 + 4 = 2 + 3 + 3.\n    c) Three 2’s cannot occur.  Indeed, 2 + 2 + 2 = 3 + 3 = 6, while 2·2·2 = 8 < 3·3 = 9; replacing {2,2,2} by {3,3} increases the product.\n    d) A 2 and a 4 cannot occur together because 2 + 4 = 3 + 3 = 6, yet 2·4 = 8 < 3·3 = 9; hence the pair {2,4} can be replaced by {3,3} to increase the product.\n    These are the only prohibitions that follow from comparisons which preserve the total sum.\n\n3.  Classification of admissible maximal–product multisets.\n    With the conclusions of Step 2, any maximal multiset can contain only 3’s together with possibly a few 2’s or 4’s, subject to\n        • no two 4’s;\n        • no (2,4) pair;\n        • at most two 2’s.\n    Consequently every maximal multiset is of one of the following four types:\n        • all 3’s;\n        • all 3’s and exactly one 4;\n        • all 3’s and exactly one 2;\n        • all 3’s and exactly two 2’s.\n\n4.  Fitting the total sum 2002.\n    Write 2002 = 3q + r where 0 ≤ r ≤ 2.  Division gives q = 667 and r = 1.\n    – All 3’s is impossible (remainder 1).\n    – All 3’s plus a single 2 would require 3k + 2 = 2002 ⇒ 3k = 2000, impossible.\n    – All 3’s plus a single 4 contributes 4 to the sum, so 3k + 4 = 2002 ⇒ k = 666.  Thus we obtain the multiset\n  {3 (666 times), 4} with n = 667.\n    – All 3’s plus two 2’s also contributes 4, so again k = 666, giving\n  {3 (666 times), 2, 2} with n = 668.\n    No other pattern yields the correct remainder r = 1, so these are the only candidates.\n\n5.  Equality of the two candidate products and maximality.\n    For the first candidate P₁ = 3^666 · 4.\n    For the second candidate P₂ = 3^666 · 2 · 2 = 3^666 · 4 = P₁.\n    Hence both multisets achieve the same product.  By Step 1 every maximal–product decomposition involves only 2’s, 3’s and 4’s, and by Step 2 it must satisfy the three prohibition rules; combining these with the residue analysis in Step 4 forces the decomposition to be one of the two determined above.  Therefore no larger product exists.\n\nMaximum–product multisets\n • {3,3,…,3,4} (666 threes and one four) with n = 667,\n • {3,3,…,3,2,2} (666 threes and two twos) with n = 668.\nBoth give the maximal product P = 3^666 · 4.",
      "_meta": {
        "core_steps": [
          "Local replacement: show any term ≥5 can be split (e.g., 5→2+3) to raise the product, so all parts ≤4.",
          "Rule-out checks: eliminate 1’s and combinations (2,4) or (2,2,2) or (4,4) via simple product comparisons, leaving only 3’s plus at most one 2, one 4, or a pair of 2’s.",
          "Residue test: use the target sum mod 3 to decide which exceptional option is needed for exact total.",
          "Compose list: take as many 3’s as possible plus the chosen exception; count the total n."
        ],
        "mutable_slots": {
          "slot_sum": {
            "description": "Given total that the a_i must add to",
            "original": 1979
          },
          "slot_residue": {
            "description": "Remainder of the sum when divided by 3, which selects the needed exception (0→all 3’s, 1→one 4 or two 2’s, 2→one 2)",
            "original": 2
          },
          "slot_exception_value": {
            "description": "Value(s) of the single non-3 term(s) inserted so the sum matches slot_sum",
            "original": 2
          },
          "slot_n": {
            "description": "Total number of terms after the construction ( = floor(slot_sum/3)+indicator )",
            "original": 660
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "calculation",
  "iteratively_fixed": true
}