+0  
 
0
428
3
avatar

How many five-digit integers are multiple of 3, or multiples of 5, or both?

 May 9, 2020
 #1
avatar
0

Between 10,000 and 99,999 there are 42,000 numbers that are either multiples of 3, or multiples of 5, or multiples of 15.

 May 9, 2020
 #2
avatar
0

a=1;b=0;c=0;d=0;e=0;p=0; cycle:n= a*10000+b*1000+c*100+d*10+e;if(n%3==0 or n%5==0 or n%15==0, goto loop, goto next); loop:printn,", ",;p=p+1; next:e++;if(e<10, goto cycle, 0);e=0;d++;if(d<10, goto cycle, 0);e=0;d=0;c++;if(c<10, goto cycle,0);c=0;d=0;e=0;b++;if(b<10, goto cycle,0);e=0;d=0;c=0;b=0;a++;if(a<10, goto cycle,0);print"Total = ",p

 

OUTPUT = 42,000 such numbers.

 May 9, 2020
 #3
avatar+33614 
+3

Let n = 99999 - 10000 + 1 = 90000

 

n/3 + n/5 - n/15 = 42000    (we subtract n/15 to avoid double counting those that are divisible by both 3 and 5).

 May 9, 2020

3 Online Users

avatar
avatar
avatar