How many Natural Numbers not exceeding 4321 can be formed with the Digits 1, 2, 3, and 4 when the digits can repeat?
This is a part of Classical Combinatorics
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I used the EXACT SAME WAY
I did it the same way. The answer reminded me of 8 mile :)
I Did it the same way! Btw nice solution @Chew-Seong Cheong +1
T h e q u e s t i o n s a y s t h a t w e h a v e t o f i n d n a t u r a l n u m b e r s u s i n g d i g i t s f r o m 1 t o 4 . B u t i t h a s n ′ t s p e c i f i e d o n t h e n u m b e r o f d i g i t s o f e a c h n u m b e r . T h u s w e h a v e t o f i n d a l l n u m b e r s w i t h d i g i t s f r o m 1 t o 4 n o t e x c e e d i n g 4 3 2 1 / W e w i l l d o t h i s c a s e w i s e . C a s e 1 : S i n g l e d i g i t n u m b e r s O b v i o u s l y 4 c a n b e f o r m e d . c a s e 2 : T w o d i g i t n u m b e r s W e h a v e f o u r p o s s i b i l i t i e s f o r t h e u n i t d i g i t a n d f o u r p o s s i b i l i t i e s f o r t h e t e n s d i g i t T h u s , 1 6 n u m b e r s c a n b e f o r m e d . C a s e 3 : 3 d i g i t n u m b e r s W e h a v e f o u r p o s s i b i l i t i e s f o r e a c h p l a c e t h u s , 6 4 n u m b e r s a r e p o s s i b l e . T i l l n o w i t h a s b e e n p r e t t y s t r a i g h t f o r w a r d b u t t h e n e x t c a s e h a s s o m e c o m p l i c a t i o n s a s w e h a v e a r e s t r i c t i o n . C a s e 4 : F o u r d i g i t n u m b e r s S u b c a s e 1 : 1 i s t h e d i g i t i n t h e t h o u s a n d t h s p l a c e T h e n w e h a v e 4 p o s s i b i l i t i e s f o r e a c h p l a c e , a s a n u m b e r w h i c h h a s 1 i n i t s t h o u s a n d t h s p l a c e w i l l b e l e s s t h a n 4 3 2 1 T h u s , w e h a v e 6 4 n u m b e r s . S u b c a s e 2 : 2 i s t h e d i g i t i n t h e t h o u s a n d t h s p l a c e T h e n w e h a v e 4 p o s s i b i l i t i e s f o r e a c h p l a c e , a s a n u m b e r w h i c h h a s 2 i n i t s t h o u s a n d t h s p l a c e w i l l b e l e s s t h a n 4 3 2 1 T h u s , w e h a v e 6 4 n u m b e r s S u b c a s e 3 : 3 i s t h e d i g i t i n t h e t h o u s a n d t h s p l a c e . T h e n w e h a v e 4 p o s s i b i l i t i e s f o r e a c h p l a c e , a s a n u m b e r w h i c h h a s 3 i n i t s t h o u s a n d t h s p l a c e w i l l b e l e s s t h a n 4 3 2 1 S u b c a s e 4 : 4 i s t h e d i g i t i n t h e t h o u s a n d t h s p l a c e . I f w e h a v e 1 o r 2 i n t h e h u n d r e t h s p l a c e t h e n 1 6 + 1 6 n u m b e r s I f t h e n u m b e r h a s 3 i n t h e h u n d r e t h s p l a c e a n d 1 i n t h e t e n s p l a c e t h e n t h e r e a r e 4 p o s s i b i l i t i e s . I f t h e n u m b e r h a s 3 i n t h e h u n d r t e t h s p l a c e a n d 2 i n t h e t e n t h s p l a c e t h e n t h e r e i s o n l y o n e p o s s i b i l i t y . A d d i n g g i v e s 3 1 3 .
As the maximum number which can be formed is 4444. Hence, we can easily calculate the numbers from 4322 upto 4444 formed with the Digits 1,2,3 & 4 only, which comes out to be 27. Now we can calculate the total numbers which can be made using the digits (1,2,3 &4) which is 4^4(4 digit numbers) + 4^3 (3 digit numbers) +4^2 (2 digit numbers) +4 (single digit number) which comes out to be 340.
Hence the answer is 340-27= 3 1 3
I a l s o d i d i t t h e s a m e w a y
PARI/GP code:
is_ok(n)=m=Vec(Str(n));i=1;while(i<=#m,if(eval(m[i])==(1||2||3||4),i++,return(0);break));return(1)
answer=0;for(i=1,4321,if(is_ok(n),answer++));return(answer)
Problem Loading...
Note Loading...
Set Loading...
We have to consider the total numbers N by stages as follows:
U p t o 4 4 4 4 4 4 3 4 4 4 4 2 4 4 4 3 1 4 4 3 2 1 4 = 4 × 4 = 4 × 4 × 4 = 3 × 4 × 4 × 4 = 1 × 2 × 4 × 4 = 1 × 1 × 1 × 4 = 1 × 1 × 1 × 1 = N u m b e r s 4 1 6 6 4 1 9 2 3 2 4 1
Therefore, the total number of natural numbers formed with digits 1, 2, 3 and 4 with repetitions N = 4 + 1 6 + 6 4 + 1 9 2 + 3 2 + 4 + 1 = 3 1 3