Hacker News new | ask | show | jobs
by drewbuschhorn 2978 days ago
I got asked a project Euler question at an interview for a crud job. I'm sure it's simple if you break it down, but there are plenty of other fish in the sea. If you ask me a question that starts: "let n be ...", I'm out.

An integer partition of a number n is a way of writing n as a sum of positive integers.

Partitions that differ only in the order of their summands are considered the same. A partition of n into distinct parts is a partition of n in which every part occurs at most once.

The partitions of 5 into distinct parts are: 5, 4+1 and 3+2.

Let f(n) be the maximum product of the parts of any such partition of n into distinct parts and let m(n) be the number of elements of any such partition of n with that product.

So f(5)=6 and m(5)=2.

For n=10 the partition with the largest product is 10=2+3+5, which gives f(10)=30 and m(10)=3. And their product, f(10)·m(10) = 30·3 = 90

It can be verified that ∑f(n)·m(n) for 1 ≤ n ≤ 100 = 1683550844462.

Find ∑f(n)·m(n) for 1 ≤ n ≤ 1014. Give your answer modulo 982451653, the 50 millionth prime.

2 comments

Questions like that are asked more to find out how people cope psychologically with ridiculously hard requirements.

Can they start picking it apart, and at least find some bits of it they can solve, or do they squirm, or whine, or rage quit?

Attacking ridiculously hard requirements is a valuable skill even in crud jobs.

Questions like that are asked more to find out how people cope psychologically with ridiculously hard requirements.

It's more like -- how they cope with some one deliberately playing with their head.

Or if they're not deliberately playing - they're at at least acting very, very pretentiously. Believing that they know how to cook up a "test" for real-life problem-solving skills. When in reality they're just parroting some toy problem they read on the internet somewhere. Or that someone that they thought was cool gave them in an interview way back when.

Can they start picking it apart, and at least find some bits of it they can solve, or do they squirm, or whine, or rage quit?

In a completely contrived and artificial context that not only bears very little resemblance to the conditions in which developers actually do need to solve difficult real-life problems - but in many ways is in fact a grotesque distortion of those conditions.

So what did you do? Just walk out?
I said, "if that's representative of the day to day work, I'm probably not a great fit for the position," and got up to walk out. They asked me stay and talk about some of my github projects, so we had a nice talk for a few minutes and then I left.

I'd gotten an offer earlier that morning, so I was a little more self-assured than I would have been otherwise.

Maybe they were just testing to see if the applicant can think for five minutes.