+0  
 
0
100
1
avatar

Wendy randomly chooses a positive integers less than or equal to 2020. The probability that the digits in Wendy's number add up to 10 is m/n, where m and n are relatively prime positive integers. Find m+n

 

Thanks in advance. 

 Apr 24, 2020
 #1
avatar
0

a=0;b=0;c=0;d=0;p=0; cycle:n=a*1000+b*100+c*10+d;if(n<2021 and a+b+c+d==10, goto loop, goto next); loop:printn,", ",;p=p+1; next:d++;if(d<10, goto cycle, 0);d=0;c++;if(c<10, goto cycle, 0);d=0;c=0;b++;if(b<10, goto cycle,0);b=0;c=0;d=0;a++;if(a<10, goto cycle,0);print"Total = ",p

 

OUTPUT: There are 2020 positive integers that Wendy can choose from. There are 120 positive integers whose digits sum up to 10.

So, the probability is: 120 / 2020 = 6 / 101 which are relatively prime. m + n = 6 + 101 =107.

 Apr 24, 2020

59 Online Users

avatar
avatar
avatar
avatar