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

Home > Just Math
Integers and their sums of digits (Posted on 2017-03-13) Difficulty: 2 of 5
Find all solutions of the system
s(x) + s(y) = x
x + y + s(z) = z
s(x) + s(y) + s(z) = y − 4,
where x, y and z are positive integers, and each of s(x), s(y) and s(z) denotes the sum of digits of x, y and z, respectively, in decimal notation.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
computer solution | Comment 2 of 3 |

 x  y  z
18 27 50
18 36 68

found by

DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 For z = 5 To 10000
   sodz = sod(z)
   xplusy = z - sodz
   For x = 1 To xplusy - 1
     DoEvents
     y = xplusy - x
     sodx = sod(x): sody = sod(y)
     If sodx + sody = x Then
       If x + sodz = y - 4 Then
          Text1.Text = Text1.Text & x & Str(y) & Str(z) & crlf
       End If
     End If
   Next
 Next
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Function sod(n)
  s$ = LTrim(Str(n))
  tot = 0
  For i = 1 To Len(s$)
   tot = tot + Val(Mid(s$, i, 1))
  Next
  sod = tot
End Function

Edited on March 19, 2017, 11:38 am
  Posted by Charlie on 2017-03-19 11:38:14

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 (0)
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