Show HN: Every Day Is Pi Day
euler.party
euler.party
Very neat demonstration!
I dispute that, although I guess the general brute-force solution is 'easy' given infinite time.
https://oeis.org/wiki/Disjunctive_numbers#Is_pi_a_disjunctiv...
> I dispute that, although I guess the general brute-force solution is 'easy' given infinite time.
Look at it this way -- if it were not true, then the digits of Pi would not be normally distributed (see https://en.wikipedia.org/wiki/Normal_number), and that would be a rather extraordinary mathematical finding.
If Pi's digits are normally distributed, then one can reliably predict the time required for finding any particular digit sequence using probability theory. And given the presumption of normalcy, that probability is the same for any digit sequence of a given length.
The probability for finding a given test digit sequence in the first 100 million digits of Pi is given here:
https://www.angio.net/pi/whynotpi.html
But it has to be emphasized that, given a finite test sequence and an infinite sequence of Pi's digits as a search space, the probability is 1.0.
Although admittedly I too find the US date system's wrong-endianness pretty annoying.
YYYY-MM-DDTHH:MM:SS+<OFFSET>
in this format, Pi day is:
2017-03-14 (The rest of the complete format omitted since it is not strictly relevant)
> jyssys3: The rest of the world celebrates it at 22/7.
I'd expect it's really 22.7., but this is more fun.
EDIT: Sibling post suggests it was fixed in 2014. I wonder what was wrong with my home laptop then, haha...
Mac's renderer happens to err on the side of drawing more pixels in case of ambiguity (e.g. calculation yields fractions of a pixel); this is why everything on a mac looks like its in bold with the default settings. Windows tends to err on the side of not rendering those pixels but this is configurable with ClearType.
If you choose non-ClearType (what Google did in the early days), you have chosen to have ugly text that will not look good on anything other than a CRT in the 90s.
Now, somewhat ironically, Google's text actually looks somewhat better than Edge's; Microsoft stopped using subpixel rendering (i.e. the best part of ClearType) in Metro/Windows Store Style/Modern/UWP apps years ago, while Chrome is still taking advantage of the feature.
The reason why subpixel rendering is disabled in modern/WinRT/UWP apps, as I understand it, is likely to do with rotation. Modern apps are designed for tablet use, where the display may be oriented in any particular direction. Subpixel rendering depends on knowing the layout of the pixel elements themselves (the position of the R, G, & B elements relative to the greater pixel). When rotated, the layout changes and subpixel rendering makes things look worse.
In an ideal world, subpixel rendering would be turned off only in situations where the display is rotated. It appears that at least the rendering surface for Edge does use subpixel rendering, just not UI elements, which is an improvement over no use at all.
Yep, I think that is literally pi to 6 million decimal places then doing an indexof of the 6 digit year and 6 digit time of day.
Edit:
I just noticed for the time digits, it seemed to be reporting something like -2 a few minutes ago.
'133343' doesn't seem to be part of the digits, which would represent 13:33:43. Unless I'm misunderstanding.
You can remove some digits and get the same result as today (see https://news.ycombinator.com/item?id=13867324), but as it lack so many situations as it does I would not say so.
Edit: Here's another estimate: with 6 million digits, we can get all 6 digit possibilities by just concatenating them all together. There's then (10^6)! ways to arrange the 6 digit strings before concatenating them. So if we picked a random 6 million digit sequence, there's (10^6)!/10^(6e6) ~ 10^(-10^5.6) chance of getting one of those. So the chance that a random 6 million digit string contains all subsequences is at least that high. But that's not saying very much!
This is related to the question: how many balls do I need to thrown randomly into N buckets so that the each bucket gets at least one ball (with high probability)? I was amused to learn recently that the answer must be more than linear in N. You might think that throwing a billion times N balls would suffice, but for very large N it won't. Even though you're throwing a billion times more balls than there are buckets! The probabalists I was talking to about this didn't know off-hand what the exact asymptotic of "enough balls" to throw was. That answer appears to depend upon the asymptotics of the second Stirling number based off this stack exchange [2]. But to complicate matters, the approximation given by the Wikipedia page [3] is precisely insufficient to answer the question! We'd need to know how it approaches that asymptotic.
[1] https://en.wikipedia.org/wiki/De_Bruijn_sequence [2] http://math.stackexchange.com/questions/174674/if-n-balls-ar... [3] https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second...
How naive do you do it? :)
When I just concatenate all possible 6-digit numbers (of which there are 1e6 = 1 million), I get 6 million digits total. You could of course overlap them partially to save space, but that does not count as "naive" anymore.
But it's not clear that it's possible to overlap all possible substrings in the right way: that's what De Bruijn sequences do but I don't consider them to be naively obvious at all.
* This is where I overlooked in my last post that De Bruijn sequences (which achieve this lower estimate) are actually for cyclic strings, allowing the subtrings to go past the end and back to the start of million digits. That allows 1 million digits to suffice. We'd actually need that 1000005 digits.
https://gist.github.com/zulln/110a1d454d07339c496cc8ec6349fe...
This means this does not work about 200 times a day in addition to about hundred whole days (for every hundred years).
For a finite, normally distributed digit sequence (as Pi is thought to be), the probability is always less than 1.0 for finding a particular sequence within it. But if you mean a specially engineered sequence designed to include all possible 6-digit sequences, then we've left the question of whether a given finite Pi sequence includes it.
Only an infinite sequence of normal digits can be assured (probability: 1.0) of matching a test digit sequence within it, even a trivial one. For all other normal digit sequences, there's a probability less than 1.0 for finding an example sequence within it.
> '133343' doesn't seem to be part of the digits, which would represent 13:33:43. Unless I'm misunderstanding.
Good example. One would think that a relatively short test sequence would be a shoo-in for being located somewhere within 100 million normal digits, but that's by no means assured.
Edit: the sequence '133343' appears 80 times in the first 100 million digits of Pi.
I've uploaded[1] the reverse system, which is quite a bit more efficient. It's a 600KB JSON array with every second in a day and its corresponding offset in Pi.
https://gist.github.com/teotwaki/253422ac235960a0d672f9a1c39...
Edit:
- Pi to its 10 millionth digit: http://pi.karmona.com/ (warning, this will severely slow down or crash your browser)
- Pi to its billionth digit: https://stuff.mit.edu/afs/sipb/contrib/pi/
Great to hear. I'll throw something together and send it your way.
Thanks!
There's a few slang definitions for "Oiler" on Urban Dictionary, but I've never heard any of them except the hockey team mascot.
but it could have been done better by preallocating an array of size [86400] (all seconds in a day)
var i, a = 1, s = false;
var steps = 10000000000;
for (i = 3; i < steps; i += 2) {
a += s ? 1/i : -1/i;
s = !s;
}
console.log(a * 4);
That loop approximates arctan(1) with a Taylor series, only using basic arithmetic operations. pi = arctan(1) * 4
Outputs: 3.141592653388201
^-- last correct digit Test sequence found at location 0.
Test sequence found at location 50366472.
2 instances of "31415926" within the first 100 million digits of pi.