+0  
 
0
363
1
avatar

If x% of four-digit numbers have a repeated digit (the repeated digits do not need to be adjacent), then what is x? Express your answer as a decimal to the nearest tenth.

 Mar 6, 2020
 #1
avatar
0

a=1;b=0;c=0;d=0;p=0; cycle:n=a*1000+b*100+c*10+d;if(a!=b and a!=c and a!=d and b!=c and b!=d and c!=d, 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 =4,464 integers have repeated digits and 4,536 integers do not, out of a total of 9,000 4-digit integers. Therefore: 4,464 / 9,000 =0.496 x 100 =49.6% =x%, or x =49.6

 

Note: In this simple case, you can work it out mathematically as follows: 1234. Starting from the left, you have 9 choices for 1.For 2 you have 10 - 1 choices =9 choices. For 3 you have 9 - 1 = 8 choices. For 4, you have 8 - 1 =7 choices . So, 9 x 9 x 8 x 7 =4,536 integres that have no repeats. And 9000 - 4536 =4,464 integers that do have repeats.

 Mar 6, 2020
edited by Guest  Mar 6, 2020

1 Online Users

avatar