Tag Info

Hot answers tagged

4

Edit: Since now even I have understood the reasoning of the elf requiring more information because after measuring the tree the solution is not unique, I can give a full implementation too. When n is the magical number 2450, then we can create all possibilities with Union[Sort /@ Select[Tuples[Divisors[n], {3}], Times @@ # === n &]] Now, what's ...


3

Perhaps shorter: << Combinatorica` factors = Join @@ ConstantArray @@@ FactorInteger@2450; toWork = {#, Tr@#} & /@ (Sort /@ Apply[Times, KSetPartitions[factors, 3], {2}] // Union) Sort[First[Transpose @@ Select[GatherBy[toWork, Last], Length@# == 2 &]], Max] // First (* {5, 10, 49} *)


2

Short, but barely shorter than halirutan's. And much uglier. And it assumes that Santa is less than 100 years old. But I'm posting it anyway: n = 2450; Cases[IntegerPartitions[#,{3},Divisors@n]~Cases~ {x__/;1x==n}&/@Range@100,x:{_,__}:>x~MinimalBy~Max->Max@x]



Only top voted, non community-wiki answers of a minimum length are eligible