Talk:Minimum multiple of m where digital sum equals m: Difference between revisions

165 a bit knotty.
(Undo revision 352952 by Rdm (talk) 140=2*2*5*7)
(165 a bit knotty.)
Line 43:
 
I think for bigger values turning the task into a problem in combinatorics will be better. Taking 140 simplistically the minimum is 5999999999999999, which obviously is not divisible by 140. The solution is 79999899999999980. So I could try 6+15 digits which sum to 134 then 7+15 digits which sum to 133 until I find a number divisible by 140. Let me call this 15 digit number set N. Note that 6+N will have the same N as 15+N, 24+N, 33+N, 42+N, 51+N, and 60+N. If I optimize this for a particular number the prime factors of 140 are 2,2,5 and 7 from which it follows that the final digit must be 0 and the last but 1 must be even. Which makes the search space very small.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 16:21, 2 February 2022 (UTC)
:Very good. That trailing zero optimisation is just ''amazing''. I used a custom counting method instead of combinatorics but it's pretty much the same idea really. 165 appears to be quite knarly, or at least around 100s which is 99 more than the total time taken for all of 1..164. 275 is even worse. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 23:22, 5 February 2022 (UTC)
7,804

edits