 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Digit sum and digit product equality (Posted on 2015-10-06) Determine the total number of values of a 6-digit positive integer N such that the sum of the digits of N is equal to the product of the digits of N.

 No Solution Yet Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer aided solution | Comment 1 of 2
DefDbl A-Z
Dim crlf\$

Form1.Visible = True

Text1.Text = ""
crlf = Chr\$(13) + Chr\$(10)

For a = 1 To 9
For b = a To 9
For c = b To 9
For d = c To 9
For e = d To 9
For f = e To 9
If a + b + c + d + e + f = a * b * c * d * e * f Then
Text1.Text = Text1.Text & a & b & c & d & e & f & "    " & a + b + c + d + e + f & crlf
End If
Next
Next
Next
Next
Next
Next

Text1.Text = Text1.Text & crlf & " done"

End Sub

finds that only the digit set 111126 works.

There are 6 places the 2 could be and then 5 places the 6 could be, so there are a total of 6*5 = 30 such integers.

 Posted by Charlie on 2015-10-06 20:28:06 Please log in:

 Search: Search body:
Forums (0)