5 ms·
This 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
by archgoon 15y ago
This 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.
- TheSOB88 15y agoYou're right - posts with nothing but a joke aren't really acceptable here. We want to discourage that sort of thing.
- jerfelix 15y ago> That's strange, about 998 being absent. What follows is definitely nonsense I had to re-read what the parent poster said to get it. So I thought I'd explain what he means when he says: > Also, "998" doesn't appear 'in sequence' (it obviously appears as 97[9 98]0 981). He is saying 998 is missing, as others have observed. He is also saying that if you took the string of digits and did a string search for "998", you'd obviously find those digits together in other places (specifically during the sequence of 979 980 981). You'd also find them at 799 800 801.
- 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)