So I'm guessing you choose 1, 2, 4, 8 for your four weights?
To balance a weight of 1 on the right, you put (1) on the left.
To balance a weight of 2 on the right, you put (2) on the left.
To balance a weight of 3 on the right, you put (1,2) on the left.
To balance a weight of 4 on the right, you put (4) on the left.
To balance a weight of 5 on the right, you put (4,1) on the left.
etc.
What i'm now saying is, can you do better than your answer of 15 if you can also put some of your weights alongside the weight your trying to balance (rather than just putting them on the opposite side - where the question is basically about sums).
Erm, I can't remember now. I think I went with difference encode, so my mind went straight to and got stuck on fibonacci (probably my first mistake), but I figured I wouldn't need some of the numbers and for some reason started at 5 (?) and can't for the life of me remember which I picked
Errr, will try to take another pass today in compile time.
I think the 4 numbers are 1,3,9 and 27, which should produce numbers up to 40. Presuming I'm right, the key is to think in base 3. I will try to expand on my answer and workings while I'm not at work.
I think an interesting question would be 'why'. As in, why is this correct, and does some other combination produce better results. Given the way the numbers pan out when you calculate, I suspect it is the best answer, but I haven't tried to show that it definitely is.
Right - I think the 1,3,9 and 27 answer is definitely right because there are only 81 possible combinations of the 4 numbers. 0 is one of those, and the other 40 have to be negative, so the maximum answer has to be 40.
you extended the analogy to a 3-way set of scales and you can put the weights anywhere, the answer becomes base 4 because.... maths?
Spoiler:
I don't think so. I think the base 3 analogy works due to a bit of a quirk - in base 3, 10 - 1 = 2, Adding another operator might mean the extension to base 4 works, but I have no idea what that operator would be...
Spoiler:
Edit: I think 'add add' would work - i.e. add 2 of the number.
I initially discarded one because if I got to two, I could take the item I'm measuring and split it across the scales with no weights and when it balances I have 1
However I didn't think much behind that
"I spent years thinking Yorke was legit Downs-ish disabled and could only achieve lucidity through song" - Mr B
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
How many such routes are there through a 20×20 grid?
This is from https://projecteuler.net/problem=15. The problem is rated as 'easy', but everyone at my work has at least a degree in maths and it wasn't an 'easy' solve for any of us.
Is this that triangle thing? If you rotated the square 45 degrees it would be like that pachinko machine maths. Only one route down the outside but many multiples inside
"I spent years thinking Yorke was legit Downs-ish disabled and could only achieve lucidity through song" - Mr B
I'm sure i've done more than the first 15 project euler questions, but now can't remember the answer. Grr. I shall ponder, as I imagine there is a "cunning" way to visualize it. Something sneakily inductive??
So yeah to get to the leading diagonal, you're kinda unconstrained - at any point, you can go either right or down. So, hence.... (somebody fill the rest in here pls...) and then you double that and VOILA!
So yeah rather than pascal's triangle, which is 1 2 1, this is 1 (2x2) 1
and for the next line, it's 1, 3x3, 3x3, 1 = 20
then 1, 4x4, 6x6, 4x4, 1 = 1+16+36+16+1 = 70 WHOOP
So that generalises to sum(i=1..n) (nCi)^2, which probably has a nicer way of expressing it, but I can't work out what immediately