Hacker Timesnew | past | comments | ask | show | jobs | submit | mb7733's commentslogin

An intuitive motivation for the solution in the article (2n choose n). For an n*n grid you have to you will take 2n steps, n "over" and n "down". All that matters is the order of the steps. So if you think of there being 2n "slots", you have to pick n to be "over", and the rest are forced to be "down". So it's n choose 2n indeed.

You can also think of it another way, without using the formula combinations, and only the fact that there are n! permutations of n objects. We can think of this a permutation of 2n items, made up of two groups of n identical items each. Using (2n!) will overcount, due to the fact that each of the "over" steps are identical, and similarly for the "down" group. We have cut down our answer by dividing out all of the repeated sequences. There will be n! redundancies for all the ways we can permute the "over" group and, the same for the "down" group. So this results in (2n!) / (n! * n!), which is exactly equal to 2n choose n. See [1] which explains permutations with repetion this in general. [Note: We pretty much re-derived the formula for combinations!]

[1] https://brilliant.org/wiki/permutations-with-repetition/


The way I thought about it: to get to the goal you have to do 20 steps: 10 times right, 10 times down. But the order of these steps does not matter, ever possible arrangement is a solution.

So for counting, you can basically think about it as a list of twenty initially empty spots. You first fill it in with your 10 down steps. The remaining 10 spots will then be the ones for the 10 right steps. So really the only choice you have to make is where to place the 10 down steps.

This question boils down to: in how many different ways can you distribute the 10 down steps over the 20 empty spots? That's 20 choose 10.


Just noticed this, but intriguingly, Catalan numbers are (2n C n)/(n+1), which hints at a connection with trees.

Off the cuff, notice that the diagonal has n+1 intersection points, and a path that never passes through the diagonal gives a forest via the isomorphism with ballot sequences [0]. Any sequence that does pass below the diagonal can be "rotated" into one that doesn't, and so there are probably n+1 paths in each "path class" on average.

Conversely, this would suggest that all paths contained in just one upper or lower triangle of the square can be counted by the Catalan numbers. Indeed, a 2x2 square has just 2 such paths and (2n C n)/(n+1) = 6/3 = 2.

[0]:https://blog.wilsonb.com/posts/2026-02-27-easy-random-trees....


Funny, but I've recently started a blog to keep my math and physics muscles working and this exact problem is the first post I've written - it is useful in high order perturbation theory in quantum mechanics that I'm planning to describe down the line. Counting these paths is cool problem but generating all of them was more challenging.

Anyway, here is the post https://kpatucha.github.io/posts/Dyck-paths-Raneys-lemma/


This was one of my favorite Project Euler problems, but getting to the mathematical solution admittedly took me a couple of weeks.

Perhaps because I was pigeon-holing this as a programming optimization problem.

I wrote about it too! [0]

[0] https://nmn.gl/blog/vibe-coding-gambling


or just rotate it by 45 degrees and pretend it's a pascal's triangle.

All news links are blocked on FB in Canada, including American sources


It wasn't published in 2025. It was published in 2009 and the rights reverted to the author in 2025, who released it for free.


Oh ok, makes sense then


The question is where are all the new apps or features that are _written_ using LLMs, since everyone is 100x more productive now.


I mean, look at the Hacker News feed and you’ll get a pretty good sample of new apps and features written by LLMs.

Are they good apps and features? Ehhhh. But let’s not pretend that they’re missing.


Preferences vary on both sides of the Atlantic. Another comment on this post complains that Americans pour beer wrong because they _do_ pour with a head.

> Also in the US (probably due to lack of training and the customer too embarrassed to complaining) tend not to fill it the brim (and so not even 16''). I've seen 2-3 inch heads and asked them to top it up. They look at me as if I've just insulted George Washington


I was skeptical about the claim that 80% of soldiers refuse to fire their weapons, so I did a little reading and it seems like the original source has been pretty much debunked. This 2011 article sums it up: https://scholars.wlu.ca/cmh/vol20/iss4/4/ but it's been doubted for decades.


I doubt whether Marshall was referring to soldiers in logitiscal roles when he made his claim about only 20-25% of soldiers firing their weapons, but I do wonder whether other people are getting confused by those numbers. About twenty years ago I looked up what the "tooth-to-tail" ratio was for various branches of the U.S. armed forces, and found anywhere from a 1:10 ratio for the army (10 soldiers in support roles not expected to see combat, v.s. 1 soldier on the front lines who would be expected to need to fire his weapon), to a 1:25 ratio for the air force (which had, naturally, a lot more support personnel, such as mechanics and so on, who would spend their whole military career in hangars or on bases and never actually flying a single plane). That's anywhere from 10% to just 4% of military personnel, depending on branch, who would be expected to fire at the enemy; the only time support personnel would be engaged in combat is if something had gone badly wrong militarily and their supply lines were being attacked.

So while the article you linked isn't confused on the subject, and I doubt Marshall was mixing support personnel in with front-line soldiers in his numbers, I do wonder whether there are people who confuse those two numbers: the number of soldiers, sailors, coasties, airmen, or marines who would never be in combat even during times of war, vs. the number who would actually be in combat and not fire.

(The article did address "what if the battle never came near where those particular soldiers were standing?", which was the other question I wondered about).


I agree. It seems impossible that its referring to support staff in those numbers. I had heard of similar studies in the British Army in ww1, with similar results (training on man-shaped targets etc) - surely the army would be unlikely to change tack based on a study with such an obviously flawed conclusion.

Not to mention the fact that this was a time of much more serious discipline issues. People were executed for desertion, and despite that many people did. There was also much malingering, up to and including literally shooting oneself in the foot. Is it so hard to believe that some people just hid when battles came?

Id be very surprised to hear from the other person that by Vietnam they had gotten it up to 95% though. My impression was that the most effective move away from this sort of thing was the move to a professional volunteer army, no conscription.


On Killing further develops the idea [0] by looking at a wider set of battles across time and, crucially, finds that by adapting training methods, the kill rate went up to beyond 90%. This then appears to come with higher rates PTSD.

0 - https://en.wikipedia.org/wiki/On_Killing


On Killing also has serious issues with credibility

it relies on SLA Marshall's dubious work, and several other examples it uses are difficult to take seriously.

it's similar to Freud, where there are shreds of truth but not really universally true or applicable.


Unlike Freud, the claims in the book are falsifiable.

The psychological model it presents is concrete enough for anyone to present evidence against it. You can use the model to make predictions about human behaviour. The same cannot be said a out Freud.

Now, that doesn't mean its true. It merely means it's not complete rubbish.


Corruption is crime but not all crime is corruption. Stealing copper isn't corruption.


Not all corruption is crime, but prob ought to be put into the laws to become crimes


Not all corruption is crime either as any ex politician earning mid 6 figures for a speech could tell you.


Overall I agree with the approach, but just wondering, why do the first point if you are already doing the last two?

> * Use the issue id at the start of every commit message for that issue

> * Use a single branch per issue, whose name also starts with the issue id

>* Use a single PR to merge that branch and close the issue

To me the noise at the start of every message is unnecessary, and given a lot of interfaces only display 80 chars of the message by default, it's not negligible.


If the pattern is consistent, it gets easier to ignore the noise when you don't need it. Like, a three/four digit number or a 3 letters and 3 numbers separated by a hyphen.

Sometimes, an issue might depend on another issue and contain commits from the other branch. Tagging each commit makes it easier to pinpoint the exact reason for that change.


> programmers who don't care about code quality and thus brutally reject code that is not of exceptional quality.

Is there a typo here? If they don't care about code why would they reject code based on quality?


> Is there a typo here?

Indeed an accidental omission by me:

programmers who don't care about code quality and thus don't brutally reject code that is not of exceptional quality.


How do you know when the articles were written?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: