Go back
Two Digits or Not Two Digits...That is The Question

Two Digits or Not Two Digits...That is The Question

Posers and Puzzles

R
Standard memberRemoved

Joined
10 Dec 06
Moves
8528
Clock
11 Mar 21
Vote Up
Vote Down

How many 4 digit numbers contain not more that two different digits?

BigDogg
Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
Clock
11 Mar 21
Vote Up
Vote Down

576

R
Standard memberRemoved

Joined
10 Dec 06
Moves
8528
Clock
11 Mar 21
Vote Up
Vote Down

Big Dogg is Correct!

venda
Dave

S.Yorks.England

Joined
18 Apr 10
Moves
86151
Clock
11 Mar 21
Vote Up
Vote Down

venda
Dave

S.Yorks.England

Joined
18 Apr 10
Moves
86151
Clock
11 Mar 21
Vote Up
Vote Down

Once again,I have successfully arrived at the wrong answer!
I realised my mistake on the post I deleted.
However I still have the wrong answer according to the answer given by dogg.
I would appreciate if someone could explain(preferably in language a 5 yr old can understand)what is wrong with my logic:-
The first digit selected cannot be a zero, so the number of digits available for selection is 9
So F(1st = 9)
The second digit selected if different from F is also 9
So S = 9
The third digit selected can only be one of 2 (F or S)
So T =2
The 4th digit can only be 1(either the same as F or the same as S)
There are 9 possibilities with only 1 digit so the sum is 9*9*2 +9 =171
OR the first selection is one of 9
The second selection is [b]the same as[b/] the first =1
The third selection is again 1 of the 9 remaining digits
The 4th selection must be the same as the third which gives the sum 9*1*9*1 +
9 = 90 so both must be wrong.
Once you get this train of thought in your head it is difficult to dislodge.
Sorry for appearing to be so thick!!

BigDogg
Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
Clock
11 Mar 21
Vote Up
Vote Down

@venda said
Once again,I have successfully arrived at the wrong answer!
I realised my mistake on the post I deleted.
However I still have the wrong answer according to the answer given by dogg.
I would appreciate if someone could explain(preferably in language a 5 yr old can understand)what is wrong with my logic:-
The first digit selected cannot be a zero, so the number of digits ava ...[text shortened]... his train of thought in your head it is difficult to dislodge.
Sorry for appearing to be so thick!!
That is an excellent line of thought, actually. It just needs some refinement.

Let's call the four digits F, S, T, and H, respectively.

Case 1: F is not equal to S

As you said, there are 9 possible digits for F.
Combine that with another 9 possible digits for S.
T must equal F, or S, so there are 2 possible digits for T.
However, there are also two possible digits for H! It, like T, can equal either F, or S.

9*9*2*2 = 324 possibilities

Case 2: F is equal to S

This one must be broken down into two sub-cases.

Sub-case A: F == S == T

F has 9 possibilities. S and T only have 1.
H has 10 different possibilities. It can be any of 0 through 9.

9*10 = 90 possibilities

Sub-case B: T is not equal to F, and not equal to S

9 possibilities for F. 1 for S.
There are 9 possibilities for T (any of 0 through 9, except for F).
There are 2 possibilities for H. (either F, or T)

9*9*2 = 162 possibilities

Total: 324 + 90 + 162 = 576 possibilities.

venda
Dave

S.Yorks.England

Joined
18 Apr 10
Moves
86151
Clock
12 Mar 21
Vote Up
Vote Down

@bigdoggproblem said
That is an excellent line of thought, actually. It just needs some refinement.

Let's call the four digits F, S, T, and H, respectively.

Case 1: F is not equal to S

As you said, there are 9 possible digits for F.
Combine that with another 9 possible digits for S.
T must equal F, or S, so there are 2 possible digits for T.
However, there are also two p ...[text shortened]... s for H. (either F, or T)

9*9*2 = 162 possibilities

Total: 324 + 90 + 162 = 576 possibilities.
Thanks for the explanation.Makes it a lot clearer
Seems I am like the horse in the steeplechase that leads all the way and then stumbles and falls at the last hurdle!

BigDogg
Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
Clock
13 Mar 21
Vote Up
Vote Down

@venda said
Thanks for the explanation.Makes it a lot clearer
Seems I am like the horse in the steeplechase that leads all the way and then stumbles and falls at the last hurdle!
Truth be told, I wrote a program to solve, first. Figured out the math later, again using programming to help.

venda
Dave

S.Yorks.England

Joined
18 Apr 10
Moves
86151
Clock
13 Mar 21
Vote Up
Vote Down

@bigdoggproblem said
Truth be told, I wrote a program to solve, first. Figured out the math later, again using programming to help.
I can do most things with spreadsheets but I've never done any programming as such apart from the odd macro when I was at work.
As an aside, I downloaded a script for my chromebook to do a task for me.
I found out later I didn't really need it but can I get rid of it?!!
I've tried everything except going back to factory settings which I don't want to do.
Every time I open any of my spreadsheets now I get the message "working" and it won't respond for a few seconds.
These things are sent to try us.

R
Standard memberRemoved

Joined
10 Dec 06
Moves
8528
Clock
13 Mar 21
Vote Up
Vote Down

Here is how I did it.


Type 0:

Single digit used - 4 digit numbers: aaaa

There are 9 choices for the digit.

Type 0 = 9

Two digits used - 4 digit numbers:

Type 1: aabb

There are C(4,2) = 6 ways to arrange 2 a's and 2 b's

aabb
bbaa

abab
baba

abba
baab

However, notice that due to symmetry the numbers in this Type are represented 2 fold: aabb = bbaa ; abab = baba ; and abba = baab

So divide by 2.

In each of the 3 remaining subgroups there are 9 ways to choose the leading digit and 9 ways remaining digit

Type 1 = 9*9*3 = 243

Type 2: aaab

There are C(4,3) = 4 ways to arrange 3 a's and 1 b

We don't have the symmetry to worry about in this type and there are 9 ways to choose the leading digit and 9 ways remaining digit.

Type 2 = 9*9*4 = 324

Thus the total set of 4 digit numbers that use not more that 2 distinct digits:

Type 0 + Type 1 + Type 2 = 9 + 243 + 324 = 576

BigDogg
Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
Clock
14 Mar 21
Vote Up
Vote Down

@venda said
As an aside, I downloaded a script for my chromebook to do a task for me.
I found out later I didn't really need it but can I get rid of it?!!
You'd have to find the location where you downloaded it, and delete it from there, or find out where you installed it, and uninstall from there.

If you cannot find it, try googling "uninstall chromebook script".

venda
Dave

S.Yorks.England

Joined
18 Apr 10
Moves
86151
Clock
14 Mar 21
Vote Up
Vote Down

@bigdoggproblem said
You'd have to find the location where you downloaded it, and delete it from there, or find out where you installed it, and uninstall from there.

If you cannot find it, try googling "uninstall chromebook script".
Thanks.
I've done all that before and the script doesn't work anymore but it still comes up with the "working" message .
There must be something it's put in the rom or perhaps it's nothing to do with the script at all!
Not a big issue,just a little annoying.
Otherwise, I can recommend chromebooks.
There are things that are unsupported but most features are very similar to microsoft without the need for security and windows updates that take ages.When I get "update available restart to install" message I click on it and the chromebook re boots in less than 15 seconds.

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.