This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts

demoAIAlgebra 2

Doubling time

Something growing 7% a year doubles in years, not : growth compounds. The logarithm is the tool that turns "how long until" into a division, and the rule of 70 is that division with and .

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Growth by a fixed fraction each year is . Asking when means solving for , and is in the exponent; the logarithm brings it down:

Any base works, since a ratio of logs does not depend on the base.

For small , and , so : the rule of 70. It is 2.4% off at 7% and 0.5% off at 3%, and a test checks both. The figure draws against the straight line , which is what "7% a year" would mean if growth did not compound.

Printed

t_double: 10.2448
10
Growth at 7% a year, compounding and not
1.07t1 + 0.07 t
123405101520yearsamount, starting from 1

Tests 4 of 4 pass

  • at 7% a year the doubling time is 10.24 years (passes)
  • after that long the amount is exactly 2 (passes)
  • the rule of 70 is 2.4% off at 7% and 0.5% off at 3% (passes)
  • the base of the logarithm does not matter: base 10 gives the same time (passes)

Forks 2

History 4 versions · adversarial review, fix, extend

Every version of this program, and what each one changed from the one before it. Each label (fork, fix, extend and so on) is a claim that the server checked when the version was posted, for most labels by running both programs. Versions that branch off the path to the current best version are hidden until you open them with the buttons below.

  1. Doubling timeAIthis page

    @adam, written with claude · 2026-09-22

    • 4 tests pass
    • 0 reviews of this exact version in this build (reviews are stored on the site's server)
    • tests from adversarial reviews: 3 fail here
    Which tests
    • fails at a rate of one part in a trillion a year, the doubling time is ln 2 / r to one part in a billion
    • fails at a rate of 1e-16 a year the doubling time is finite, 6.9e15 years
    • fails money shrinking 5% a year never doubles: the doubling time is infinite

  2. adversarial review3 added tests fail on the reviewed version

    Doubling time breaks at tiny rates and at negative onesAIproblem

    @adam, written with claude · 2026-09-24

    • 8 tests pass, 4 fail (expected: a problem post's failing tests are what it asks someone to fix)
    • 0 reviews of this exact version in this build (reviews are stored on the site's server)
  3. fix4 tests that fail on the version above pass here

    Doubling time, fixed for tiny and negative ratesAIcurrent best

    @adam, written with claude · 2026-09-24

    • 12 tests pass
    • 0 reviews of this exact version in this build (reviews are stored on the site's server)
    • tests from adversarial reviews: 0 fail here, 3 pass here

Checked when the site was built: 4 of 4 tests passed, in under 0.1 s. Download 2026-09-22-doubling-time.viv