News for hackers. Stuff that matters.
Re:Decomposing a Factorial into Large Factors by SJC_Hacker on Friday March 28, 2025 @01:56PM (#43508268)
Edit: as pointed out, you can't simply divide by each number, because then its not equal to original number factorial. However, I've fixed the algorithm somewhat maintaining the basic idea

The "naive" way

  100!= 2*3*4*...*99*100
Obviously t(100) > 1. If we can get rid of the single 2, we know that t(100) > 2. If you multiply the whole thing by 2/2 (=1),

  100! = (2/2)*2*3*4*...*50*...99*100
       = (2*2/2)*3*4*...*50*...99*100
       = (4/2)*3*4*...*50*...99*100
       = 4*3*4*...*50*...99*(100/2)
       = 3*4*4*...*50*50*...99
We can continue with t(100) > 3 by multiplying by 3/3 and pairing it with 99, i.e. 99*3*(3/3) = (99/3)*3*3 = 33*9 yielding

  100! = 4*4*5*...*9*9*10*..*33*33*...*50*50...*97*98
However, once we get to t(100) > 4, trying to get rid of 4, we have to skip 98 since its not divisible by 4. The other problem is we have two 4s... If we had instead using 98 for getting rid of 2, we can then use 100, and 96 for the other 4. This is our first "gotcha" for the naive algorithm of always picking the largest number, which seems intuitive at first glance.

Now if we test all possibilities starting with 2, we get 48 choices for the dividing 2 (even numbers > 2, not including 2 which will not increase t(100) beyond 2. Then ~33 choices for dividing 3 (depending if our div of 2 resulted in a factor of 3), ~25 for 4, But notice since we now have two 4s, we have to do it twice, so its 25*24 choices for getting rid of 4.*

Re:Decomposing a Factorial into Large Factors by dudinax on Friday March 28, 2025 @02:47PM (#43508738)
The naive way has to have a 1 in it since what you give only has 99 factors.
Re:Decomposing a Factorial into Large Factors by pansa2 on Friday March 28, 2025 @03:11PM (#43508968)
> 100 = 3*4*...*50*50*...99

You can’t replace 2*100 with 50, it has to be 4*50. But there’s no reason you have to divide by 2 at all - why not replace 2*99 with 6*33?

Re:Decomposing a Factorial into Large Factors by SJC_Hacker on Friday March 28, 2025 @03:54PM (#43509307)
Thanks, I've fixed the idea

The basic idea is to "pair" the lowest numbers with the highest ones - sort of pushing everything towards the middle values

Like I said, its naive greedy and non-optimal - otherwise time would be linear.