+0  
 
0
56
2
avatar

A number is called "descending" if each digit is less than the digit to its left. For example, the number 432 is descending, but 443 and 345 are not.

How many six-digit descending numbers are there?

 Feb 23, 2020
 #1
avatar
+1

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

 

OUTPUT = 210 such numbers

 Feb 23, 2020
 #2
avatar
+1

This consists of the sum of : 5C0 + 6C1 + 7C2 + 8C4 + 9C5 =1 + 6 + 21 + 56 + 126 =210 numbers.

 Feb 23, 2020

16 Online Users

avatar
avatar