Hacker News new | past | comments | ask | show | jobs | submit login

As people have pointed out:

1/98 = 0.01 02 04 08 16 32 ...

1/998 = 0.001 002 004 008 016 032 064 128 256 ...

but there's also a degenerate case, where you have no 9s at all:

1/8 = 0.1 + 0.02 + 0.004 + 0.0008 + ...

and what's surprising here is that everything adds up and gives you the terminating decimal 0.125 that you were expecting.




> 1/8 = 0.1 + 0.02 + 0.004 + 0.0008 + ...

The sum of a convergent series is a / (1 - r) where a is the first value, and r is the ratio between the n+1th and nth term.

    a = 1/10, r = 1/5

    n = (1 / 10) / (1 - (1 / 5))
    n = (1 / 10) / (4 / 5)
    n = 5 / 40
    n = 1 / 8


I knew that. I left it as an exercise for the commenter.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: