2025/04/28

Newest at the top

2025-04-28 17:33:09 +0200 <tomsmeding> so you need n decimal decimal digits to represent 1/2^n
2025-04-28 17:32:55 +0200 <tomsmeding> furthermore, that multiplier (5^n) is not divisible by 10 ever because it has no factors of 2, so 1/2^n is not an integer multiple of 1/10^(n-1)
2025-04-28 17:32:23 +0200 <tomsmeding> EvanR: 1/2^n is an integer multiple of 1/10^n: the multiple is 5^n, because 5^n * 1/10^n = (1/2)^n = 1/2^n
2025-04-28 17:31:18 +0200 <tomsmeding> it does show where int-e's powers of 5 end up
2025-04-28 17:31:14 +0200prdak(~Thunderbi@user/prdak) (Read error: Connection reset by peer)
2025-04-28 17:31:02 +0200 <EvanR> check it for n up to 10^900 and I'll start to be convinced (just kidding)
2025-04-28 17:30:42 +0200 <int-e> [exa]: do you know the variant for binomial coefficients, https://en.wikipedia.org/wiki/Lucas%27s_theorem ?
2025-04-28 17:30:25 +0200 <tomsmeding> anyway this checks the claim for 1 <= n <= 50 :p
2025-04-28 17:30:23 +0200 <EvanR> fine I'll use paper
2025-04-28 17:29:24 +0200 <lambdabot> Int -> CReal -> String
2025-04-28 17:29:23 +0200 <EvanR> :t showCReal -- now with more unqualified
2025-04-28 17:29:19 +0200 <tomsmeding> "dividing by powers of 2 is easy. Just exponentiate 5 and add some zeros"
2025-04-28 17:28:36 +0200[exa]reminded of that "zeros at the end of factorial" exercise
2025-04-28 17:28:23 +0200 <lambdabot> True
2025-04-28 17:28:22 +0200 <tomsmeding> > and [Data.Number.CReal.showCReal 80 (realToFrac (1 % 2^n)) == "0." ++ (let s = show (5^n) in replicate (n - length s) '0' ++ s) | n <- [1..50]]
2025-04-28 17:27:44 +0200 <int-e> Same here.
2025-04-28 17:27:35 +0200 <EvanR> I mean "if you understand it it's obvious"
2025-04-28 17:26:35 +0200 <int-e> EvanR: Right. I mean it's not *quite* tautological... you may understand a complicated thing and it still won't be obvious. But this particular factoid isn't complicated.
2025-04-28 17:26:13 +0200 <tomsmeding> these two numbers are alike
2025-04-28 17:26:02 +0200 <EvanR> in decimal
2025-04-28 17:26:00 +0200 <lambdabot> "0.00000095367431640625"
2025-04-28 17:25:59 +0200 <tomsmeding> > Data.Number.CReal.showCReal (53 + 16) (realToFrac (1 % 2^20))
2025-04-28 17:25:58 +0200 <EvanR> k powers of 5 end in 5
2025-04-28 17:25:51 +0200 <lambdabot> • In the second argument of ‘showCReal’, namely ‘(1 % 2 ^ 20)’
2025-04-28 17:25:51 +0200 <lambdabot> • Couldn't match expected type ‘CReal’ with actual type ‘Ratio a0’
2025-04-28 17:25:51 +0200 <lambdabot> error:
2025-04-28 17:25:49 +0200 <tomsmeding> > Data.Number.CReal.showCReal (53 + 16) (1 % 2^20)
2025-04-28 17:25:39 +0200 <EvanR> tautology 37
2025-04-28 17:25:34 +0200 <lambdabot> 95367431640625
2025-04-28 17:25:33 +0200 <tomsmeding> > 5 ^ 20
2025-04-28 17:25:29 +0200 <int-e> once you understand it it will be obvious ;)
2025-04-28 17:24:49 +0200 <EvanR> not obvious to me
2025-04-28 17:24:35 +0200 <EvanR> but also a power of 5
2025-04-28 17:24:29 +0200 <EvanR> each time you multiply by 1/10 you get a nother power of two
2025-04-28 17:24:26 +0200 <int-e> ;-)
2025-04-28 17:24:24 +0200 <int-e> call me crazy, but I think that's actually true
2025-04-28 17:24:15 +0200 <int-e> it's almost as if 1/2^n = 5^n/10^n
2025-04-28 17:23:39 +0200 <int-e> (It worked, but I should be using 17.)
2025-04-28 17:23:39 +0200acidjnk_new(~acidjnk@p200300d6e71c4f61394430d048071491.dip0.t-ipconnect.de) (Ping timeout: 268 seconds)
2025-04-28 17:23:18 +0200 <tomsmeding> Claim: if n >= 1 then the last digit is always 5. Claim: length of decimal expansion is n. Both admit a simple proof by induction :)
2025-04-28 17:22:34 +0200 <lambdabot> "0.000010000000000000000818030539140313095458623138256371021270751953125"
2025-04-28 17:22:33 +0200 <int-e> > Data.Number.CReal.showCReal (53 + 16) (realToFrac 0.00001)
2025-04-28 17:22:24 +0200 <EvanR> o_O
2025-04-28 17:22:20 +0200 <EvanR> you said decimal
2025-04-28 17:22:20 +0200 <tomsmeding> and the number of _decimal_ digits is, too
2025-04-28 17:22:17 +0200 <lambdabot> 16.609640474436812
2025-04-28 17:22:16 +0200 <int-e> > logBase 0.5 0.00001
2025-04-28 17:22:15 +0200 <tomsmeding> yes
2025-04-28 17:22:09 +0200 <EvanR> the number of binary digits of 1/2^n is n, what were you talking about
2025-04-28 17:21:59 +0200 <int-e> EvanR: so keeping track of that power of 2 tells you how many decimal digits you need