module.exports = { slug: "rule-of-72-and-exact-doubling-time", title: "Rule of 72 and exact doubling time", deck_category: "finance", description: "Estimates the years to double an investment with the Rule of 72 approximation and computes the exact doubling time with logarithms.", inputs: [ { name: "annual_rate_percent", type: "number", unit: "%", required: true, description: "Annual compound growth rate", min: 0.0001 } ], outputs: [ { name: "approx_years", unit: "years", description: "Rule of 72 approximation: 72 / rate" }, { name: "exact_years", unit: "years", description: "Exact doubling time using logarithms" } ], steps: [ "Rule of 72 approximation: approx_years = 72 / annual_rate_percent.", "Convert the rate to a decimal: r = annual_rate_percent / 100.", "Exact doubling time: exact_years = ln(2) / ln(1 + r).", "Round approx_years and exact_years to 2 decimals." ], constants: [ { name: "rule_of_72_numerator", value: 72, unit: "dimensionless", source: 0 } ], sources: [ { kind: "edition_page", value: "Brealey, Myers, Allen, Principles of Corporate Finance, 13th ed., Chapter 3, box on the Rule of 72", title: "Principles of Corporate Finance", publisher: "McGraw-Hill", retrieved_utc: "2026-09-30T19:31:29Z", note: "Rule of 72 approximation and the exact doubling-time formula t = ln(2)/ln(1+r)" } ], disclaimer: null, questionText(inputs) { return `Using the Rule of 72 and the exact logarithmic formula, how many years does it take to double an investment growing at ${inputs.annual_rate_percent}% per year?`; }, run(inputs) { const { annual_rate_percent } = inputs; if (typeof annual_rate_percent !== "number" || annual_rate_percent <= 0) throw new Error("annual_rate_percent must be a positive number"); const approx_years = Math.round((72 / annual_rate_percent) * 100) / 100; const r = annual_rate_percent / 100; const exact_years = Math.round((Math.log(2) / Math.log(1 + r)) * 100) / 100; return { answer: `Approximately ${approx_years.toFixed(2)} years (Rule of 72); exactly ${exact_years.toFixed(2)} years`, values: { approx_years, exact_years } }; }, examples: [ { name: "worked example", inputs: { annual_rate_percent: 8 }, expected: { answer: "Approximately 9.00 years (Rule of 72); exactly 9.01 years" }, check: "hand computation: approx = 72/8 = 9.00; exact = ln(2)/ln(1.08) = 0.693147.../0.076961... = 9.0065..., rounds to 9.01" }, { name: "test vector: low rate", inputs: { annual_rate_percent: 3 }, expected: { answer: "Approximately 24.00 years (Rule of 72); exactly 23.45 years" }, check: "hand computation: approx = 72/3 = 24.00; exact = ln(2)/ln(1.03) = 0.693147.../0.029559... = 23.4498..., rounds to 23.45" } ] };