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

The pattern will break down once you get past 8192, which is 2^13. That means that the pattern continues for an impressive 52 significant figures (well, it actually breaks down on the 52nd digit, which will be a 3 instead of a 2).

The reason it works is that 9998 = 10^4 - 2. You can expand as

    1 / (10^n - 2) = 1/10^n * 1/(1 - 2/10^n)
                   = 1/10^n * (1 + 2/10^n + 2^2 /10^2n + 2^3 /10^3n + ...)
which gives the observed pattern. It breaks down when 2^k has more than n digits, which happens approximately when

    2^k > 10^n   =>   k > n log(10) / log(2)
which comes out to 4 * log(10)/log(2) = 13.28 when n = 4.

---

Another pattern can be generated from the power series expansion

    x / (1 - x)^2 = x + 2x^2 + 3x^3 + 4x^4 + ...
setting x = 1/10^n gives the infinite series

    1/10^n + 2/10^2n + 3/10^3n + ...
which leads to the neat fact that

    1 / 998001 = 0.000 001 002 003 004 005 006 007...
---

Another example is the fraction

    1000 / 997002999 = 0.000 001 003 006 010 015 021 ...
which goes through the triangle numbers[0] in its expansion, or

    1 / 998999 = 0.000 001 001 002 003 005 008 013 021 ...
which goes through the Fibonacci numbers[1].

---

Getting the squares is harder, but you can do it with

    1001000 / 997002999 = 0.001 004 009 016 025 036 049 ...

[0] http://en.wikipedia.org/wiki/Triangle_number

[1] http://en.wikipedia.org/wiki/Fibonacci_number




If you'd like to continue the pattern beyond 52 digits, just keep adding 9s to the original fraction... 1/9999999999998 = 1.0000000000002 0000000000004 0000000000008 0000000000016 0000000000032 0000000000064 0000000000128 0000000000256 0000000000512 0000000001024 0000000002048 0000000004096 0000000008192 0000000016384 0000000032768 0000000065536 0000000131072 00000002621440... × 10^-13


For the fibonacci, add a 9 on both sides of the denomator

1/998999 1/99989999 1/9999899999

To get more 0 spacing and avoid overflow


This should be denominator ;-)


interestingly, this works the other way around too: 1/98 = 0. 01 02 04 08 16 32 65...

and even further? 1/8 = 0.125


That's because 1=1

If I'm not mistaken. We should utilize the self-similarity much more often.


The pattern is not really breaking. What happens is that 16384 doesn't fit in a 4 digit space so it's first digit "1" jumps to 8192 and it becomes 8193. Then the next number (32768) add it's first digit "3" to 16384 and it becomes 16387 and so on, so the sequence appears strange after 4096: ...409681936387...


I think that's what you would call a break in a pattern though. Of course, the infinite series will stay infinite.


I agree, but what I took from it is that it continues to be defined by that series even after that point (just in a less recognizable way). It could have just been a remarkable coincidence that it follows that series for so long.


> The pattern will break down

It doesn't actually:

      4096 8193 6387
    = 4096+8192
    +         1 6384
    +           …


I noticed this on the last bit of wolframs display space also. The fact that it continues and is basically infinite sequence arithmetic overflow is insanely beautiful.


1/7 does it too. 14 28 56 128 <- too big


[deleted]


The same. It's simply regular addition that happens to overflow.


You can seemingly increase the digit space by doing 1/99998 or so.


Perhaps this explanation is helpful:

    1 / (10000 - 2) = 1/10000 * 1/(1 - 2/10000)
Notice that the sum of a geometric series is:

    1/(1 - x) = sum_k( x^k )
    1/(1 - 2/10000) = sum_k( (2/10000)^k )
So:

    1/10000 * 1/(1 - 2/10000) = 1/10000 * (1 + 2/10000 + 2^2/10000^2 + 2^3/10000^3 + ...)


1 in 8192 is the chance of encountering a wild shiny pokémon.




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

Search: