2

I'm doing a Math project on Digits Sums, and I don't really want to try to figure out all the 4-digit numbers that add up to 2, 3, 4, 5, and 6. That's partly because it would be hard, and also, because I don't want to get anything wrong, or it would throw off my entire project... Can anyone help me?

  • 1
    Do you need to know how many such numbers have a digit sum of a certain number (example: 2), or do you need the actual numbers? Finding the amount of such numbers is easy, but I can't see of any way to find the actual numbers easily. – George V. Williams May 23 '13 at 23:55
  • The actual numbers, unfortunately. I just tried to go through a list of all the #'s between 1000 and 6000 (Digit sums 1-6), and it was sheer torture, I got into the 4000s and I'm sure I missed some. But if I could get the amount of the numbers with that digit sum, it would probably help. – Confuddled May 24 '13 at 00:17
  • Are you asking for an actual algorithm to compute them? I do not see how simply listing them by hand is elaborate enough for a math project. Also, to know how many there are, check out the stars and bars method of counting. – Jon Claus May 24 '13 at 00:21
  • 1
    You're in (some) luck, the OEIS has a list of digit sums of numbers from 0 - 10000 listed here (from sequence A007953). This would make it exceptionally easy to copy, either manually or using a computer program such as Excel. Also, you can significantly reduce computation time by introducing some tricks (which I could explain to you, if you're interested). – George V. Williams May 24 '13 at 00:26
  • Umm, no, I'm not looking for an algorithm; the theme of the math project is research, such as discovering or studying something. I couldn't decide a topic, and was given this. For the project I'm compiling all the 1, 2, 3, and (hopefully) 4 digit numbers with digit sums between 1 and 6. For example, with 2-digit numbers: Sum=1: 10, Sum=2: 11, 20, etc. then I'm adding them all up, and I put those sums in an x/y plot to try to organize them. Through that i discovered something really interesting, but I want to test it with 4 digit numbers as well. – Confuddled May 24 '13 at 00:30
  • George, that sound really cool (as far as math can be cool), could you explain? I might not be able to use the information, but something might be helpful. By the way, George, YOU are a lifesaver! – Confuddled May 24 '13 at 00:31
  • If you want a number which has a digit sum of $2$, then these numbers are at least $9$ apart (so they can be further apart, but not closer apart). So when we check $1001$ and get that the digit sum is $2$, we don't have to check any numbers until $1010$ (which also matches). We can then skip to $1019$, $1028$, and so on. This means you only have to check $999$ numbers instead of your usual $9000$. Another thing that might interest you: a number is divisible by $3$ if and only if its digit sum is divisible by $3$. – George V. Williams May 24 '13 at 00:46
  • That's interesting, Thanks George! I'm not sure if I can incorporate that, but thank you! – Confuddled May 24 '13 at 00:58

2 Answers2

1

Instead of going through a list, think about how you can make these sums. For example, $4$ can only be $4+0+0+0, 3+1+0+0, 2+1+1+0, 2+2+0+0, 1+1+1+1$. Now think about the ways to permute them, remembering that $0$ can't be first. You can compute that and check that you have the right number. For example, $2+1+1+0$ you can choose the location of the $0$ three ways, then the location of the $2$ three ways, for nine in all.

Ross Millikan
  • 374,822
0

Let me make sure I understand the question. Is this what you mean by "all the 4-digit numbers that add up to 6"?

6000; 1005 1050 1500 5001 5010 5100; 2004 2040 2400 4002 4020 4200; 1014 1041 1104 1140 1401 1410 4011 4101 4110; 3003 3030 3300; 1023 1032 1203 1230 1302 1320 2013 2031 2103 2130 2301 2310 3012 3021 3102 3120 3201 3210; 1113 1131 1311 3111; 2022 2202 2220; 1122 1212 1221 2112 2121 2211

That was a tedious couple of minutes, but I wouldn't go so far as to call it "sheer torture". Did I miss any?

Edit: OOPS! I don't know if I missed any, but towards the end I forgot that they had to be 4-digit numbers! Edited out the 5- and 6-digit numbers at the end.