Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ok, I hope somebody has a really good logical explanation of this, or maybe even some other awesome examples?


Explanation: 0.0001+0.00000002+0.00000000004 etc = 2^0/10^4 + 2/10^8 + 2^2/10^12 etc

which is a geometric sequence with common ratio 2/10000 and first term 1/10000

So it has an infinite sum of (1/10000)/(9998/10000) = 1/9998

Same for powers of 3: 1/9997

Actually 1/8 = 0.125 is an example of this; it just breaks down very early because 4+0.8+0.16+0.032+0.0064+... = 5


Similarily, 1/9999 gives you powers of 1 (which is just 1), 1/9997 powers of 3, and so on.


The fact that 10000 - 2 = 9998 probably has something to do with it. Compare and contrast the result for 1 / 99998.


Pretty much.

1/9998 = 1/(10000-2) = 1/(10000)*1/(1-2/(10000)

Since 2/10000 is very small, it is well approximated by the taylor expansion for 1/(1-x), which is simply

Sum(x^n)

Since x is 2/10000, we get powers of two, which keep getting shifted to the right. Like a bit pattern, they don't overlap when added, so we get the sequence above.


Simple high-school maths.

    S = 0.00010002000400080016...

    S = 0.0001 + 0.0000 0002 + 0.0000 0000 0004 + 0.0000 0000 0000 0008 + ...

    S = 2^0 / 10000^0 + 2^1 / 10000^1 + 2^2 / 10000^2 + 2^3 / 10000^3 + ...

    S = sum to infinity of (2/10000)^i
You might have noticed this is a geometric series with ratio 2/10000 = 0.0002.

    S = 0.0001 / (1 - 0.0002) = 0.0001 / 0.9998 = 1/9998



1/(1 - x) = 1 + x + x^2 + x^3 + x^4 + ...

so,

1/(1 - .0002) = 1 + .0002 + .0002^2 + ...

and

1/9998 = .0001/(1 - .0002).


Sorcery!


math voodoo ! it's beautifull indeed.




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

Search: