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

Home > Numbers
A counting task (Posted on 2018-08-23) Difficulty: 3 of 5
a. How many 5-digit numbers exist where one of its digits equals the sum of all other digits?
b. What is the sum of all those numbers?

No leading zeroes.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 7
 For n = 10000 To 99999
   s$ = LTrim(Str(n))
   largest = 0: total = 0
   For i = 1 To 5
      v = Val(Mid(s, i, 1))
      total = total + v
      If v > largest Then largest = v
   Next
   If largest = total - largest Then
     ct = ct + 1
     tot = tot + n
     Text1.Text = Text1.Text & n & crlf
   End If
   DoEvents
 Next
 
 Text1.Text = Text1.Text & crlf & ct & Str(tot) & " done"

finds

2658 such numbers adding up to 109249191.

  Posted by Charlie on 2018-08-23 10:00:05
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 (11)
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