8 ms·
Fun with math: Dividing one by 998001 yields a surprising result
- soosh 15y agoThis reminded me of a fun fact from an old professor's paper: 1/99007599 has a binary expansion of period 48993900. http://www.math.ucsb.edu/~agboola/teaching/2005/winter/old-115A/murty.pdf http://www.math.ucsb.edu/~agboola/teaching/2005/winter/old-1...
- m_for_monkey 15y agoThe source with real (readable) text, without annoying animation: http://www.futilitycloset.com/2012/01/08/math-notes-76/ http://www.futilitycloset.com/2012/01/08/math-notes-76/
- easy_rider 15y agoSo we're missing 998 here in actuality ?
- m_for_monkey 15y agoYes. And 1/9801 skips 98.
- archgoon 15y agoThis can be seen in python with (I had to dig into the docs for this, so here are the fruits of my labor :) ) import decimal decimal.getcontext().prec=1000 dec = decimal.Decimal(1)/decimal.Decimal(998001) #now doctor it up to see the numbers strdec = str(dec)[2:] #chop off the '0.' nums = zip(strdec[::3],strdec[1::3],strdec[2::3]) print nums
- mkmk 15y agoI don't have a python shell available... what happens after 999?
- deleted 15y ago[deleted]
- archgoon 15y agoIt repeats. EDIT: Um... I answered the good man's question. Could someone explain why this correct answer was voted down so I may improve it? I recognize that it is short, but that's really all there is too it. It's a decimal expansion, not a border collie.
- boredguy8 15y agoThe period is 2997, so set precision to 2997 if you want to see the repeat. Also, "998" doesn't appear 'in sequence' (it obviously appears as 97[9 98]0 981).
- SandB0x 15y agoEdit: That's strange, about 998 being absent. What follows is definitely nonsense: Don't really have time to think about this, but you can sort of generate the sum (ie by looking at the pattern) with (1/1000) * sum i * 1000^-i , i = 0 to infinity You could try and do a sum of a sum of geometric series and make it work http://www.wolframalpha.com/input/?i=sum+i+*+1000%5E-i%2C+i%3D1+to+infinity http://www.wolframalpha.com/input/?i=sum+i+*+1000%5E-i%2C+i%... (998001 / 2997 = 3)
- archgoon 15y agoIt's necessary that one number is absent. The period is 2997 as he mentions. Can't pack 1000 3 digit numbers into that ;)
- Generic_Name 15y agoChuck Norris could :P
- Generic_Name 15y agoNo sense of humor. Seriously.
- mindcrime 15y agoIt isn't about having, or not having, a sense of humor. It's just that Hacker News culture prides itself on maintaining a certain decorum to the discussion here... and it doesn't include internet memes, Chuck Norris jokes, or a lot of the other frivolous stuff that's accepted on Reddit, Digg, Slashdot, etc. It's not that people here are stuffy, or humorless, or anything; we just want HN to be different, and not decay into a festering cesspool of malfeasance like Slashdot or whatever. There are plenty of places one can go to get that kind of stuff on the 'net. Here at HN, it will usually be downvoted mercilessly.
- phzbOx 15y agoYou've got an extra ) on the 'nums = .....'
- VMG 15y agoecho "scale=3000; 1/998001" | bc
- wtn 15y agoIn ruby (irb): require 'bigdecimal'; BigDecimal.new(1).div(998001, 2997)
- kenver 15y agoI was searching for some iOS documentation and found this and it's totally ruined my productivity! Can anyone explain why it repeats in this way, or link to a place that has an explanation?
- knerd83 15y agoFor x < 1, 1 + 2x + 3x^2 + 4x^3 + ... converges to 1/(1-x)^2. When x = 0.001, you get 1/.999^2 = 1000000/998001 = 1.002003004005...
- nodemaker 15y agoHere is a more detailed explanation 1--------- If x = 0.001 then the sum x^2 + 2x^3 + 3x^4…. in its decimal places will have all the three digit numbers except the the second last starting with 000,001 and then till 997,999. As pointed out by someone below,the reason 998 is missing is because after 997998999 the next coefficient is 1000.This overflow 1 will carry over and mess up all the nines to the right until it hits the eight at which point it will make it a 9.Therefore the series will become 997999000001002003... as subsequent overflows keep messing up the last digit to the left.During the addition of the 2000th term a similar thing will happen and the series at that location will become ...997999001002003...... and it will keep losing a term from the beginning in the subsequent 998 repetitions. More generally if x = 10^-n,n>0 then the sum x^2 + 2x^3 + 3x^4 will have all the n digit numbers starting with (n-zeroes),(n-1 zeroes 1)…except the second last (10^n-2). 2--------- From http://en.wikipedia.org/wiki/Geometric_series http://en.wikipedia.org/wiki/Geometric_series An infinite geometric series converges to a/(1-r) if and only if the absolute value of r is less than 1. a + ar^2 + ar^3 .... = a/(1-r) if |r|<1 -------> [1] 3--------- 1 + 2x + 3x^2..... = (1) + (x+x) + (x^2+x^2+x^2).... = (1+x+x^2...) + (x+x^2+x^3...) + ... = 1/(1-x) + x/(1-x) + (x^2)/(1-x) + .... since x < 1 from [1] = (1+x+x^2....)/(1-x) = 1/(1-x)^2 since x < 1 from [1] ---------> [2] 4--------- So the number 0.000001002003004……997999000001002003.... = (x^2 + 2x^3 + 3x^4…..) , x = 0.001 = (x^2) * (1 + 2x + 3x^2 …..) = (x^2)/((1-x)^2) = (0.001)^2/(0.999)^2 = ((1/999))^2 = 1/998001 More generally the sum which has all the n digit numbers except (10^n-2) in its decimal places is given by (10^n-1)^(-2).
- mauro_oto 15y agoThe link is blocked at my workplace. I really don't understand how their filter system works.
- kenkam 15y agoSame here! For the category 'pornography'...
- mrgoldenbrown 15y agoWe have websense here and it too seems to block perfectly benign things with bogus reasons. This link is categorized as adult content.
- 286c8cb04bda 15y agoIHC is far from benign. They've moved the most explicit stuff to a different domain, but the site is still NSFW, generally.
- kenver 15y agoIt's clearly geek porn.
- mattcofer 15y agoSame here
- jerfelix 15y agoIt has the word Boobies in one of the comments.
- deleted 15y ago[deleted]
- drcube 15y agoHa ha, mine too. It says it's "adult content". There's a special place in hell for business owners who inflict Websense or any other method of censoring content on their own employees. If you don't trust me to use it, don't give me a computer, or an internet connection.
- foobarbazgarply 15y agoIs there a number f(n) such that 1/f(n) yields all n-digit numbers, and is there a formula f to generate them?
- emillon 15y agoYou may play with the Champernowne constant : http://en.wikipedia.org/wiki/Champernowne_constant http://en.wikipedia.org/wiki/Champernowne_constant
- troystribling 15y agoYou can see it at Wolfram Alpha http://www.wolframalpha.com/input/?i=1%2F998001 http://www.wolframalpha.com/input/?i=1%2F998001
- deleted 15y ago[deleted]
- slamdunc 15y agoThanks for posting. I'm trying to keep a collection of these type of things so that when she's ready, it'll be another tool to get/keep my daughter excited about math.
- skystorm 15y agoCare to share? Would be handy to have for my daughter... :)
- slamdunc 15y agoI'll start a post when I have enough worth sharing. She's 4 now and we're still working with basic math. I've found a few books that incorporate math that she's enjoyed; right now we're halfway through The Phantom Tollbooth. Milo just left Dictionopolis so we're headed to Digitopolis shortly...
- adeelk 15y agoMake sure you show her Gauss’s trick for summing arithmetic series.
- onedognight 15y agoThere's no 998 (and it's not a rounding issue)! ... 995 996 997 999
- tspiteri 15y agoAnd even the suggested 1/9801 for two digits produces no 98 ... 95 96 97 99 00 01 02 ... And extrapolating it to one digit, 1/81 gives 0.012345679012345679...
- joejohnson 15y agoAgain, the 100 overflows to the 99. This makes the 99 a 100 and then that overflows again and the 98 turns to a 99.
- jeffcapeshop 15y agoyou could always do 1/99980001 - that would have a 0998
- hammock 15y agoBut it would lack a 9998.
- jeffcapeshop 15y agothen i suppose we need 1/9999800001 !
- jQueryIsAwesome 15y agoBut it would lack... just kidding. Another way to get the real consecutive numbers is to make a rest so we avoid that annoying increment at the end: 1/998001 - 1e-1000
- onedognight 15y agoIt's because the 1000 will end up adding one to the 999 which becomes 1000 which adds one to 998.
- psykotic 15y agoThere's some sleight of hand here. Not all the digits are exactly right. Look how it skips from 997 to 999: http://www.futilitycloset.com/2012/01/08/math-notes-76/ http://www.futilitycloset.com/2012/01/08/math-notes-76/ Here's the math. Suppose you want a unit fraction 1/n with decimals that cycle through the 4-digit sequence abcd. Multiply by 10^4 to shift abcd into integer position, leaving repeating copies after the decimal point: 10^4/n = abcd + 1/n Solving for n gives n = (10^4 - 1) / abcd. More generally, if you want to get a cycle equal to the d digits of an integer k, you want n = (10^d - 1) / k. However, this only gives a true unit fraction when k divides 10^d - 1, so that n is an integer. Otherwise you are forced to truncate n and getting an approximate version of the cycle. That's exactly what happened here: 10^d - 1 is not divisible by the integer 001002...998999. Here's a small Python program that will generate the unit fraction given the number of digits to cycle through: import sys n = int(sys.argv[1]) s = ''.join(("%0" + str(n) + "d") % (i,) for i in range(10**n)) print "1/%d" % ((10**len(s) - 1) / int(s),) Usage: $ python magic.py 3 1/998001 $ python magic.py 4 1/99980001 This has just the right flavor for a Project Euler problem.
- bdg 15y agoI just want to know I appreciate you posting this. Some people might be interested in "wow math sure can do some funky stuff", but others like myself really want to know why. I figure that's also covers a sizable group of us here on Hacker News.
- toasterweasel 15y agoIt does indeed. I have a love/hate relationship with math. Love because it's fascinating and intergal to an understanding of our universe, hate because I had some horrible math teachers over the years...plus I do admit to being slightly lazy.
- jklp 15y agoThere is no why. It just is. This is the worst thing about being human :) http://www.smbc-comics.com/index.php?db=comics&id=1914 http://www.smbc-comics.com/index.php?db=comics&id=1914
- jerfelix 15y ago... and 1/9999999800000001 = .00000000 00000001 00000002 00000003 00000004 00000005 00000006 ... 99999996 99999997 99999999 ...repeating Basically, the pattern is 1 over some number of 9s, followed by an 8, followed by the same number of 0s, followed by a 1. So, 1/81, 1/9801, 1/998001, 1/99980001, 1/9999800001, etc.
- xuki 15y agoit's 9x9, 99x99, 999x999, 9999x9999,....
- onemoreact 15y agoNow for fun figure out why they all just skip N-1. AKA 1/81 = 012345679 not 0123456789.
- quandrum 15y agoIt's because the it generates .0123456789(10), which in base 10 is actually .0123456790
- jerfelix 15y agoYou can have more fun if you mix up the length of the 9's. For example, 1/9999/99 = 1/989901 = .00 00 01 01 02 02 03 03 ... 97 97 98 99 00 00 01 01 ... 1/999/9 = 1/8991 = .000 111 222 333 444 555 666 777 889 repeating.
- jbdevon 15y agoAlso, 1/4999 yields the sequence of square numbers.
- tspiteri 15y agoIt's really powers of 2, not square numbers. That is, 2^x, not x^2.
- jrockway 15y agoIncidentally, understanding how this works is helpful to programmers. If you know why this happens, you'll know why you can't write: double x = 0.1; and get something that works.
- mjb 15y ago> you can't write ... and get something that works. That's taking things a bit far, isn't it? Sure, you can't exactly express 0.1 as a double - but you can get many things that work really well using the approximation.
- jrockway 15y agoWhat I meant to say was, "you can't expect something with a terminating representation in base 10 to always have a terminating representation in base 2". When you play with these cases in base 10, it builds intuition that can be applied to base 2 math.
- monsterix 15y agoDid you read on Egyptian fractions? http://en.wikipedia.org/wiki/Egyptian_fraction http://en.wikipedia.org/wiki/Egyptian_fraction :)
- akkartik 15y agoWhat happens after 999? It wraps around back to 000! This is cool.
- masak 15y agoWell, being a rational number, it has to wrap around somewhere. And since 999 + 001 == 000 (with the caveats for carries that people have explained elsewhere), it makes sense for it to wrap around at that point.
- tylerneylon 15y agoThe general any-number-base-b rule here (as others have noticed in base 10^k) is that 1/(b-1)^2 = 0.0123456... (where '1', '2'.. are base b digits). The original post is this fact in base 1000. Proof for any base: 1/(b-1) = 1/b + 1/b^2 + 1/b^3 + .. = 0.11111.. (base b). So 1/(b-1)^2 = 0.11111.. * (1/b + 1/b^2 + 1/b^3 + ...) = 0.012345... QED. Richard Feynman beat us all to the punch here by noticing that 1/243 = 0.004115226337..., a fact which he wrote in a letter from a secret lab to someone in the outside world, and which put him under suspicion of sending secret messages! That gem of a fraction turns out to be a result of the above stuff as 1/243 = 111 * (1/999^2) + 4/999. Here's a slightly more detailed explanation: http://tylerneylon.com/b/archives/51 http://tylerneylon.com/b/archives/51
- saraid216 15y agoI just want to repeat bdg's appreciation for the people who are explaining the actual theory, which is the interesting part. Funky results from arbitrary arithmetic is just a step short of numerology and while it's nifty in a stage magic kind of way, it's a little sad overall when you have no idea why that's the way it is.
- skeptical 15y agoDon't underestimate stupidity. Only a tiny percentage of people want to know why that's the way it is. The big majority will call you names if you attempt to discuss the maths. Stupidity is more popular and more appealing than reason. Want to be popular, be stupid and appeal to the stupid.
- reedcat 15y agoMy productivity for today went downhill! :) Love the trick with how this can be done via differentiating the equation: 1 + r + r^2 + ... = 1/(1-r)
- mrobataille 15y agoSet up a recursion: 1000x - .001 (repeating) = x The .001 repeating = 1/999, simplify, voila.
- deltasquared 15y ago;Here is my version in Common Lisp ;Supply your own flatten function ;or borrow one from let-over-lambda or something ;http://letoverlambda.com/lol.lisp (defun long-div (dividend divisor depth) (cond ((> depth 0) (flatten (list (truncate (/ dividend divisor)) (long-div (* 10 (mod dividend divisor)) divisor (- depth 1))))) (t ())))
- dbbo 15y agoHmm. http://www.reddit.com/r/math/comments/oiv7s/cool_fraction/ http://www.reddit.com/r/math/comments/oiv7s/cool_fraction/
- Tim-Boss 15y agoThat's nothing! 6922251 * 8 on a calculator spells my ex's nickname....
- dimitar 15y agoSome fun that can fit on a poket calculator: 12345679 * 9 = 111111111 12345679 * 18 = 222222222 12345679 * 27 = 333333333 12345679 * 36 = 444444444 12345679 * 45 = 555555555 12345679 * 54 = 666666666 12345679 * 63 = 777777777 12345679 * 72 = 888888888 12345679 * 81 = 999999999 12345679 * 999999999 = 12345678987654321
- donnawarellp 15y agothis is my personal fav
- buddydvd 15y agoAnd this too: 111111111111111111111111111 / 9 = 12345679012345679012345679
- grusk 15y agoThe way I was introduced to this was as a math trick: Pick a number 1-9, multiply by 9, then 12345679, and you get a string of whatever number you picked. Also, pick any three-digit number, multiply by 7, 11, and 13 (or 1001), and you get your three-digit number repeated twice.
- bbloomberg 15y agoYou can find the Catalan numbers buy computing 500,000,000,000 - Sqrt(500,000,000,000*500,000,000,000 - 1).... http://people.csail.mit.edu/devadas/numerics_demo/chord.html http://people.csail.mit.edu/devadas/numerics_demo/chord.html For an explanation better than I can provide of what they are and how it works, see 6.006 lecture 11 notes! http://courses.csail.mit.edu/6.006/fall11/lectures/lecture11.pdf http://courses.csail.mit.edu/6.006/fall11/lectures/lecture11...
- fryguy 15y agoA simple way to figure out how this works is to figure out another way to write it out. For the simpler case (1/9801) = 0.00010203... 0.00 + 0.0001 + 0.000002 + 0.00000003 ... -------------- Each row is equal to x, but shifted over 2x digits. This is the same as dividing by 10^x. This simplifies to the formula: sum k=0 to infinity: k/(10^k) This is fairly easily calculable, and results in 1/9801. Try it yourself on wolfram alpha: http://www.wolframalpha.com/input/?i=%28sum_%28k%3D1%29%5Einfinity%28%28k-1%29%2F%28100%5Ek%29%29 http://www.wolframalpha.com/input/?i=%28sum_%28k%3D1%29%5Ein...
- ilitirit 15y ago1. Take 1 as a divisor 2. Choosing a suitable dividend 3. Calculate quotient 4. Instant interesting observation!
- liljimmytables 15y agoSlightly off-topic, but it bugs me that the article feels obliged to contain a picture of the number. Firstly, why the hell would you want to display plain text as a picture? Secondly, if I click through to the source, I get a slightly better picture. Did IHC take a photo of the original website with their phone camera and upload it? Mind is boggling. Encouraged by the better quality picture on geekosystem I decided to click through to THEIR source. And there's a plaintext version. Kudos to <a href="http://www.futilitycloset.com/2012/01/08/math-notes-76/<FutilityCloset</a> http://www.futilitycloset.com/2012/01/08/math-notes-76/<...; for having a modicum of common sense.
- gsivil 15y agoTry taking the square root of it
- human_error 15y ago1/49 is "almost" surprising. 0.0204081632
- dbieber 15y agoFor all squares, http://m.wolframalpha.com/input/?i=100010000%2F999700029999&x=0&y=0 http://m.wolframalpha.com/input/?i=100010000%2F999700029999&... 100010000/999700029999 Tack on extra 0s and 9s to allocate more digits per square.