How many five digit even integers have a digit sum of 13?
edit: i dont want them listed I want a way to do it
There are 968 such numbers that begin with:
10048 10066 10084 10138 10156 10174 10192 10228 .............etc.
Note: If you want them all listed, just let us know.
Here is a "brute force and ignorance" piece of pseudo code to count the number of five-digit even integers that have a digit sum of 13:
Set n = 0 n is the counter
for k = 10000 : 2 : 99998 loop from 10000 to 99998 in steps of 2
a = floor(k/10^4)
t = k – a*10^4
b = floor(t/10^3)
t = t – b*10^3
c = floor(t/10^2)
t = t – c*10^2
d = floor(t/10)
t = t – d*10
sum = a + b + c + d + t
if sum ==13 then n = n+1
end for loop
display n
Alan: Here is a "brute force and ignorance" REAL code that lists 968 numbers with a sum total of 13. But, that is not what the questioner wants! He/she, I believe, wants a solution using combinations and permutations, and I haven't the faintest idea how to approach it!.
n=0;p=0;cycle:a(10000+n);b=int(a/10000);c=int(a/1000);d=c%10;e=int(a/100);f=e%10;g=int(a/10);h=g%10;i=int(a/10);j=a%10;n=n+1;if(a%2==0 and b+d+f+h+j==13, goto loop,goto cycle);loop:p=p+1;printa," ",;if(n<84001, goto cycle, 0);print"Total = ",p
OK, young person, here is a solution to your problem courtesy of Wolfram/Alpha:
expand | (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9) (1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9)^4:
x^45 + 5 x^44 + 15 x^43 + 35 x^42 + 70 x^41 + 126 x^40 + 210 x^39 + 330 x^38 + 495 x^37 + 714 x^36 + 992 x^35 + 1330 x^34 + 1725 x^33 + 2170 x^32 + 2654 x^31 + 3162 x^30 + 3675 x^29 + 4170 x^28 + 4620 x^27 + 4998 x^26 + 5283 x^25 + 5460 x^24 + 5520 x^23 + 5460 x^22 + 5283 x^21 + 4998 x^20 + 4620 x^19 + 4170 x^18 + 3675 x^17 + 3162 x^16 + 2654 x^15 + 2170 x^14 + 1725 x^13 + 1330 x^12 + 992 x^11 + 714 x^10 + 495 x^9 + 330 x^8 + 210 x^7 + 126 x^6 + 70 x^5 + 35 x^4 + 15 x^3 + 5 x^2 + x.
So, the answer is the coefficient x^13, which is 1725 minus 757, which is number that sums up to 13 for all ODD numbers.
Therefore, the total number of all EVEN 5-digit numbers that sum up to 13 is =1,725 - 757 =968 such numbers.
How many five digit even integers sums up to 13
5 digit even integerspartitionpermutation−partition−permutation9{4,0,0}0P(4,1),P(4,2),P(4,3){4,0,0},{3,1,0},{2,1,1}(62){2,2,0}9{2,0,0}2P(2,1),P(2,2),P(2,3){2,0,0},{1,1,0}(42)9{0,0,0}413!3!=1=(22)8{5,0,0}0P(5,1),P(5,2),P(5,3){5,0,0},{4,1,0},{3,1,1}(72){3,2,0},{2,2,1}8{3,0,0}2P(3,1),P(3,2),P(3,3){3,0,0},{2,1,0},{1,1,1}(52)8{1,0,0}4P(1,1),P(1,2),P(1,3){1,0,0}(32)7{6,0,0}0P(6,1),P(6,2),P(6,3)(82)7{4,0,0}2P(4,1),P(4,2),P(4,3)(62)7{2,0,0}4P(2,1),P(2,2),P(2,3)(42)7{0,0,0}613!3!=1=(22)6{7,0,0}0P(7,1),P(7,2),P(7,3)(92)6{5,0,0}2P(5,1),P(5,2),P(5,3)(72)6{3,0,0}4P(3,1),P(3,2),P(3,3)(52)6{1,0,0}6P(1,1),P(1,2),P(1,3)(32)5{8,0,0}0P(8,1),P(8,2),P(8,3)(102)5{6,0,0}2P(6,1),P(6,2),P(6,3)(82)5{4,0,0}4P(4,1),P(4,2),P(4,3)(62)5{2,0,0}6P(2,1),P(2,2),P(2,3)(42)5{0,0,0}813!3!=1=(22)4{9,0,0}2P(9,1),P(9,2),P(9,3)(112)4{7,0,0}2P(7,1),P(7,2),P(7,3)(92)4{5,0,0}4P(5,1),P(5,2),P(5,3)(72)4{3,0,0}6P(3,1),P(3,2),P(3,3)(52)4{1,0,0}8P(1,1),P(1,2),P(1,3)(32)3{10,0,0}0P(10,1),P(10,2),P(10,3)(122){10,0,0}−3!1!2!3{8,0,0}2P(8,1),P(8,2),P(8,3)(102)3{6,0,0}4P(6,1),P(6,2),P(6,3)(82)3{4,0,0}6P(4,1),P(4,2),P(4,3)(62)3{2,0,0}8P(2,1),P(2,2),P(2,3)(42)2{11,0,0}0P(11,1),P(11,2),P(11,3)(132){11,0,0}−3!1!2!{10,1,0}−3!1!1!1!2{9,0,0}2P(9,1),P(9,2),P(9,3)(112)2{7,0,0}4P(7,1),P(7,2),P(7,3)(92)2{5,0,0}6P(5,1),P(5,2),P(5,3)(72)2{3,0,0}8P(3,1),P(3,2),P(3,3)(52)1{12,0,0}0P(12,1),P(12,2),P(12,3)(142){12,0,0}−3!1!2!{11,1,0}−3!1!1!1!{10,2,0}−3!1!1!1!{10,1,1}−3!1!2!1{10,0,0}2P(10,1),P(10,2),P(10,3)(122){10,0,0}−3!1!2!1{8,0,0}4P(8,1),P(8,2),P(8,3)(102)1{6,0,0}6P(6,1),P(6,2),P(6,3)(82)1{4,0,0}8P(4,1),P(4,2),P(4,3)(62)
Sum off all permutations:
(22)+(32)+(42)+(52)+(62)+(72)|9…, and 8…+(22)+(32)+(42)+(52)+(62)+(72)+(82)+(92)|7…, and 6…+(22)+(32)+(42)+(52)+(62)+(72)+(82)+(92)+(102)+(112)|5…, and 4…+(42)+(52)+(62)+(72)+(82)+(92)+(102)+(112)+(122)+(132)−2×3!1!2!−1×3!1!1!1!|3…, and 2…+(62)+(82)+(102)+(122)+(142)−3×3!1!2!−2×3!1!1!1!|1…=(22)+(32)+(42)+(52)+(62)+(72)⏟=(83)( hockey stick identity)|9…, and 8…+(22)+(32)+(42)+(52)+(62)+(72)+(82)+(92)⏟=(103)( hockey stick identity)|7…, and 6…+(22)+(32)+(42)+(52)+(62)+(72)+(82)+(92)+(102)+(112)⏟=(123)( hockey stick identity)|5…, and 4…+(42)+(52)+(62)+(72)+(82)+(92)+(102)+(112)+(122)+(132)⏟=(143)−(32)−(22)( hockey stick identity)−2×3!1!2!−1×3!1!1!1!|3…, and 2…+(62)+(82)+(102)+(122)+(142)−3×3!1!2!−2×3!1!1!1!|1…=(83)+(103)+(123)+(143)−((22)+(32))⏟=(43)( hockey stick identity)+(62)+(82)+(102)+(122)+(142)−5×3!1!2!−3×3!1!1!1!=(83)+(103)+(123)+(143)−(43)+(62)+(82)+(102)+(122)+(142)−5×3!1!2!−3×3!1!1!1!(82)+(83)=(93)(102)+(103)=(113)(122)+(123)=(133)(142)+(143)=(153)=(93)+(113)+(133)+(153)−(43)+(62)−5×3!1!2!−3×3!1!1!1!=(93)+(113)+(133)+(153)−(43)+(62)−5×3−3×6=(93)+(113)+(133)+(153)−(43)+(62)−33=84+165+286+455−4+15−33=968