{
  "schemaVersion": 1,
  "slug": "coin-value-calculator",
  "category": "fun",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "8379d60a8016e4a72732916a4bb3fccca959ea329c04f9ef6d33c07a8af6f99a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/coin-value-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "V = Σ cₖvₖ; W = Σ cₖgₖ",
    "vars": [
      [
        "cₖ",
        "Number of coins of denomination k"
      ],
      [
        "vₖ",
        "Face value per coin of denomination k, in the selected currency"
      ],
      [
        "gₖ",
        "Grams per coin of denomination k, using standard specifications"
      ],
      [
        "V",
        "Total face value in USD or EUR"
      ],
      [
        "W",
        "Estimated total weight in grams"
      ]
    ],
    "note": "For each denomination, multiply its count by its face value and add the subtotals. Estimate weight by multiplying each count by the standard grams per coin. Only the selected currency is included; USD and EUR are not converted or added together. The largest face-value contribution is the denomination with the largest subtotal, not necessarily the highest-value single coin. Weights use modern standard specifications; older U.S. coins and wear can differ. This is not a collectible appraisal."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-01",
    "domain": "math",
    "sources": [
      {
        "name": "U.S. Mint — Coin Specifications",
        "url": "https://www.usmint.gov/learn/coins-and-medals/circulating-coins/coin-specifications"
      },
      {
        "name": "European Central Bank — Common sides: euro coin specifications",
        "url": "https://www.ecb.europa.eu/euro/coins/common/html/index.en.html"
      }
    ]
  },
  "contract": {
    "compute": "const usd=[['pennies',pennies,1,2.5],['nickels',nickels,5,5],['dimes',dimes,10,2.268],['quarters',quarters,25,5.67],['halfDollars',halfDollars,50,11.34],['dollarCoins',dollarCoins,100,8.1]];\nconst eur=[['euro1',euro1,1,2.3],['euro2',euro2,2,3.06],['euro5',euro5,5,3.92],['euro10',euro10,10,4.1],['euro20',euro20,20,5.74],['euro50',euro50,50,7.8],['euro100',euro100,100,7.5],['euro200',euro200,200,8.5]];\nconst items=currency==='USD'?usd:eur;\nif(!['USD','EUR'].includes(currency)||items.some(x=>!Number.isInteger(x[1])||x[1]<0||x[1]>1000000))return{totalValue:null,totalCoins:null,weightLb:null,weightKg:null,mostValuable:null,valuePerCoin:null,currencyCode:null,__error:'inputError'};\nlet cents=0,coins=0,weight=0,best=0,bestNames=[];\nconst symbol=currency==='USD'?'$':'€';\nconst names={pennies:'Pennies',nickels:'Nickels',dimes:'Dimes',quarters:'Quarters',halfDollars:'Half dollars',dollarCoins:'Dollar coins'};\nconst rows=items.map(([name,count,value,grams])=>{const amount=count*value;cents+=amount;coins+=count;weight+=count*grams;if(amount>best){best=amount;bestNames=[name];}else if(amount===best&&amount>0)bestNames.push(name);return{denomination:symbol+(value/100).toFixed(2),count,amount:amount/100,grams:count*grams};});\nreturn{totalValue:cents/100,totalCoins:coins,weightLb:weight/453.59237,weightKg:weight/1000,mostValuable:bestNames.length?bestNames.map(n=>symbol+(items.find(i=>i[0]===n)[2]/100).toFixed(2)).join(' / '):'None',valuePerCoin:coins?cents/100/coins:0,__coinRows:rows,currencyCode:currency};",
    "inputs": [
      {
        "name": "currency",
        "type": "select",
        "default": "USD",
        "options": [
          {
            "value": "USD"
          },
          {
            "value": "EUR"
          }
        ]
      },
      {
        "name": "pennies",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "nickels",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "dimes",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "quarters",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "halfDollars",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "dollarCoins",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "USD"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro1",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro2",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro5",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro10",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro20",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro50",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro100",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      },
      {
        "name": "euro200",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000000,
        "step": 1,
        "showWhen": {
          "currency": [
            "EUR"
          ]
        },
        "requiredValue": true,
        "coinCount": true,
        "strictRange": true
      }
    ],
    "outputs": [
      {
        "name": "totalValue",
        "precision": 2,
        "unit": "$",
        "unitField": "currencyCode",
        "trimTrailingZeros": true
      },
      {
        "name": "totalCoins",
        "precision": 0,
        "unit": "",
        "trimTrailingZeros": true
      },
      {
        "name": "weightLb",
        "precision": 2,
        "unit": "lb",
        "trimTrailingZeros": true
      },
      {
        "name": "weightKg",
        "precision": 3,
        "unit": "kg",
        "trimTrailingZeros": true
      },
      {
        "name": "mostValuable",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "valuePerCoin",
        "precision": 3,
        "unit": "$",
        "unitField": "currencyCode",
        "trimTrailingZeros": true
      },
      {
        "name": "currencyCode",
        "type": "text",
        "unit": ""
      }
    ],
    "interpret": null
  }
}
