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

 Sum Productive Digits (Posted on 2014-12-31)
N is a positive integer. S(N) denotes the sum of digits of N and P(N) denotes the product of digits of N.

Determine the values of N given that: N = 2*S(N)*P(N)

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solutions Comment 2 of 2 |
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf\$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents

For n = 4 To 10000000 Step 4
If n = 2 * sod(n) * pod(n) Then
Text1.Text = Text1.Text & n & crlf
End If
DoEvents
Next
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

Function pod(n)
s\$ = LTrim(Str(n))
prod = 1
For i = 1 To Len(s\$)
prod = prod * Val(Mid(s\$, i, 1))
Next
pod = prod
End Function

finds three solutions:

12
216
432

 Posted by Charlie on 2014-12-31 12:14:30

 Search: Search body:
Forums (0)