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

m
no edit summary
(Number with 11 as a prime factor.)
mNo edit summary
Line 44:
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)
::I must find the time to code this! Until such time I need to add a new rule when 11 is a prime factor. For a number to be divisible by 11 the sum of the digits in the odd places - the sum of the digits in the even places must be a multiple of 11 including zero. Candidates should be constructed with this in mind. Note that the above rules can of course be extended to include 200, 100, 50, and 25--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 12:01, 7 February 2022 (UTC)
a number to be divisible by 11 the sum of the digits in the odd places - the sum of the digits in the even places must be a multiple of 11 including zero. Candidates should be constructed with this in mind. Note that the above rules can of course be extended to include 200, 100, 50, and 25--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 12:01, 7 February 2022 (UTC)
2,172

edits