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

Home > Just Math
Extreme Sum Settlement (Posted on 2015-09-28) Difficulty: 3 of 5
Determine the total number of 8-digit base ten positive integers such that the sum of the four leftmost digits is equal to precisely 15 more than the sum of four rightmost digits.

*** Assume non leading zero for each of the numbers.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution the computer doesn't tire of writing the numbers | Comment 2 of 4 |
The first four digits must not allow leading zeros, but any digit including zero may be in the 5th position, so the last four digits may begin with zero.

                        Ways for given s.o.d. among 4 digits 
sum of digits      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17 
w/o leading zeros  0   1   4  10  20  35  56  84 120 165 219 279 342 405 465 519 564 597 
with leading zeros 1   4  10  20  35  56  84 120 165 220 282 348 415 480 540 592 633 660 

                        18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
                       615 615 597 564 519 465 405 342 279 219 165 120  84  56  35  20  10   4   1
                       670 660 633 592 540 480 415 348 282 220 165 120  84  56  35  20  10   4   1
                       
The ways for a full 8-digit number is the number of ways for each part separately, multiplied together:
   1 * 519 =   519
   4 * 564 =  2256
  10 * 597 =  5970
  20 * 615 = 12300
  35 * 615 = 21525
  56 * 597 = 33432
  84 * 564 = 47376
 120 * 519 = 62280
 165 * 465 = 76725
 220 * 405 = 89100
 282 * 342 = 96444
 348 * 279 = 97092
 415 * 219 = 90885
 480 * 165 = 79200
 540 * 120 = 64800
 592 *  84 = 49728
 633 *  56 = 35448
 660 *  35 = 23100
 670 *  20 = 13400
 660 *  10 =  6600
 633 *   4 =  2532
 592 *   1 =   592
total       911304 such 8-digit integers.


DefDbl A-Z
Dim crlf$, nlzero(36), lzero(36)


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 For a = 0 To 9
 For b = 0 To 9
 For c = 0 To 9
 For d = 0 To 9
   t = a + b + c + d
   If a <> 0 Then nlzero(t) = nlzero(t) + 1
   lzero(t) = lzero(t) + 1
 Next
 Next
 Next
 Next
 
 For i = 0 To 36
   Text1.Text = Text1.Text & mform(i, "###0")
 Next
 Text1.Text = Text1.Text & crlf
 For i = 0 To 36
   Text1.Text = Text1.Text & mform(nlzero(i), "###0")
 Next
 Text1.Text = Text1.Text & crlf
 For i = 0 To 36
   Text1.Text = Text1.Text & mform(lzero(i), "###0")
 Next
 Text1.Text = Text1.Text & crlf
 
 
 
 For low = 0 To 36 - 15
   Text1.Text = Text1.Text & mform(lzero(low), "###0") & " *" & mform(nlzero(low + 15), "###0") & " =" & mform(lzero(low) * nlzero(low + 15), "#####0") & crlf
   totnumber = totnumber + lzero(low) * nlzero(low + 15)
 Next
 
 Text1.Text = Text1.Text & totnumber & crlf & " done"
  
End Sub

Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function


     

  Posted by Charlie on 2015-09-28 15:56:47
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

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