All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Count them correctly (Posted on 2015-10-12) Difficulty: 2 of 5
How many distinct 4 digits numbers can you form
using members of (1,2,2,3,4,4,4) ?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution same answer Comment 2 of 2 |
(In reply to I did it my way (spoiler?) by Steve Herman)

There are

  4 that use the digits 3444
  4 that use the digits 2444
 12 that use the digits 2344
  6 that use the digits 2244
 12 that use the digits 2234
  4 that use the digits 1444
 12 that use the digits 1344
 12 that use the digits 1244
 24 that use the digits 1234
 12 that use the digits 1224
 12 that use the digits 1223

for a total of 114.

Written out, those are:

3444
   3444
   4344
   4434
   4443   4
2444
   2444
   4244
   4424
   4442   4
2344
   2344
   2434
   2443
   3244
   3424
   3442
   4234
   4243
   4324
   4342
   4423
   4432   12
2244
   2244
   2424
   2442
   4224
   4242
   4422   6
2234
   2234
   2243
   2324
   2342
   2423
   2432
   3224
   3242
   3422
   4223
   4232
   4322   12
1444
   1444
   4144
   4414
   4441   4
1344
   1344
   1434
   1443
   3144
   3414
   3441
   4134
   4143
   4314
   4341
   4413
   4431   12
1244
   1244
   1424
   1442
   2144
   2414
   2441
   4124
   4142
   4214
   4241
   4412
   4421   12
1234
   1234
   1243
   1324
   1342
   1423
   1432
   2134
   2143
   2314
   2341
   2413
   2431
   3124
   3142
   3214
   3241
   3412
   3421
   4123
   4132
   4213
   4231
   4312
   4321   24
1224
   1224
   1242
   1422
   2124
   2142
   2214
   2241
   2412
   2421
   4122
   4212
   4221   12
1223
   1223
   1232
   1322
   2123
   2132
   2213
   2231
   2312
   2321
   3122
   3212
   3221   12
114 done


DefDbl A-Z
Dim crlf$, avail As Variant, nstr As String, ct

Private Sub Form_Load()
 ChDir "C:\VB5 projects\flooble"
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
  
 avail = Array(0, 1, 2, 1, 3)
 nstr = ""
 addOn 1
 
 
 
Text1.Text = Text1.Text & ct & " done"
End Sub


Sub addOn(wh)
  outerSave$ = nstr
  For i = 0 To avail(wh)
    nstrSave$ = nstr
    nstr = nstr + String(i, LTrim(Str(wh)))
    If Len(nstr) < 4 Then
      If wh < 4 Then addOn wh + 1
    ElseIf Len(nstr) = 4 Then
      Text1.Text = Text1.Text & nstr & crlf
      sv$ = nstr
      innerCt = 0
      Do
        Text1.Text = Text1.Text & "   " & nstr
        innerCt = innerCt + 1
        ct = ct + 1
        permute nstr
        If nstr = sv Then Text1.Text = Text1.Text & "   " & innerCt
        Text1.Text = Text1.Text & crlf
        
      Loop Until nstr = sv
      Exit For
    End If
    nstr = nstrSave
  Next
  nstr = outerSave
End Sub


  Posted by Charlie on 2015-10-12 10:42:20
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information