Birthday Paradox with Leap Years
code-golf probability-theory
Background
The birthday paradox is a popular problem in probability theory which defies (most people's) mathematical intuition. The problem statement is:
Given N people, what is the probability that at least two of them have the...
They're becoming increasingly common in challenges, so it seems like a reference for folks who'd like to include them in their challenges would be a good resource to have.
A Golf of Two Cities
code-golf kolmogorov-complexity
Write a program in as few bytes as possible to output the opening sentence of A Tale of Two Cities:
It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, ...
Counting in pyramids
code-golf numbers
You should write a program or function which receives a list of non-repeating integers as input and outputs number of occurrences of each of the input numbers in the following upside-down number pyramid.
Starting from the original list in every step we cr...
@Optimizer dude, it's been in there an hour. we always try to encourage people to leave it there for at least a day, so don't start rushing it, because you're impatient to post your solution. :P
@aditsu What do vectorised operations do for unequal lengths? just append the elements of the longer vector? I would have expected it to either wrap or truncate the shorter one.
but if you just append the original array then you potentially end up with different types where you don't expect them
As answered elsewhere, calling functions like memcpy with invalid or NULL pointers is undefined behaviour, even if the length argument is zero. In the context of such a function, especially memcpy and memmove, is a pointer just past the end of the array a valid pointer?
I'm asking this question ...
Background
The birthday paradox is a popular problem in probability theory which defies (most people's) mathematical intuition. The problem statement is:
Given N people, what is the probability that at least two of them have the same birthday (disregarding the year).
The problem is usually...
@orlp Thanks, I'll pass that on to the dev team, though TLS certs were wonky for meta even before our CloudFlare transition anyway, as far as I remember.
It's also a total ripoff of Explanation Formatter. (It's actually completely different, I just don't like being the "inspiration for a more popular question")
@MartinBüttner Partial solution: seq:1,2,3,6,11,23 -seq:_,1,2,3,6,11,23 finds those sequences where 1 2 3 6 11 23 occurs in the beginning and nowhere else.
It really can show up at any level as long as there's a sequence that matches the first however many terms. There's probably a lot of sequences that start with 1,2,3,4
That's not the first time you've said that. Is there any evidence that it's CJam hate and not just a normal downvote? I've had answers downvoted, despite not using CJam.
I've been using a stack snippet for a while to generate leaderboards for my simpler or more popular code golf challenges. I want to share the code for this snippet here so others can use it more easily as well.
Feel free to put feature requests and bug reports in answers, or let me know in chat....
well yeah of course there is an infinite number of ways, but I don't know if there are multiple substantially different approaches which are feasible to golf and still meet the time limit.